@@ -15,7 +15,7 @@ import { getFonts } from "font-list";
1515import { MainTray } from "./tray" ;
1616import { Thumbar } from "./thumbar" ;
1717import { StoreType } from "./store" ;
18- import { isDev , getFileID , getFileMD5 } from "./utils" ;
18+ import { isDev , getFileID , getFileMD5 , metaDataLyricsArrayToLrc } from "./utils" ;
1919import { isShortcutRegistered , registerShortcut , unregisterShortcuts } from "./shortcut" ;
2020import { join , basename , resolve , relative , isAbsolute } from "path" ;
2121import { download } from "electron-dl" ;
@@ -199,7 +199,7 @@ const initWinIpcMain = (
199199 name : common . title || basename ( filePath ) ,
200200 artists : common . artists ?. [ 0 ] || common . artist ,
201201 album : common . album || "" ,
202- alia : common . comment ?. [ 0 ] ,
202+ alia : common . comment ?. [ 0 ] ?. text || "" ,
203203 duration : ( format ?. duration ?? 0 ) * 1000 ,
204204 size : ( size / ( 1024 * 1024 ) ) . toFixed ( 2 ) ,
205205 path : filePath ,
@@ -226,6 +226,11 @@ const initWinIpcMain = (
226226 fileSize : ( await fs . stat ( filePath ) ) . size / ( 1024 * 1024 ) ,
227227 // 元信息
228228 common,
229+ // 歌词
230+ lyric :
231+ metaDataLyricsArrayToLrc ( common ?. lyrics ?. [ 0 ] ?. syncText || [ ] ) ||
232+ common ?. lyrics ?. [ 0 ] ?. text ||
233+ "" ,
229234 // 音质信息
230235 format,
231236 // md5
@@ -242,8 +247,12 @@ const initWinIpcMain = (
242247 try {
243248 const filePath = resolve ( path ) . replace ( / \\ / g, "/" ) ;
244249 const { common } = await parseFile ( filePath ) ;
245- const lyric = common ?. lyrics ;
246- if ( lyric && lyric . length > 0 ) return String ( lyric [ 0 ] ) ;
250+ const lyric = common ?. lyrics ?. [ 0 ] ?. syncText ;
251+ if ( lyric && lyric . length > 0 ) {
252+ return metaDataLyricsArrayToLrc ( lyric ) ;
253+ } else if ( common ?. lyrics ?. [ 0 ] ?. text ) {
254+ return common ?. lyrics ?. [ 0 ] ?. text ;
255+ }
247256 // 如果歌词数据不存在,尝试读取同名的 lrc 文件
248257 else {
249258 const lrcFilePath = filePath . replace ( / \. [ ^ . ] + $ / , ".lrc" ) ;
0 commit comments