@@ -166,22 +166,17 @@ const saveMeta = (downloadInfo: LX.Download.ListItem) => {
166166 : Promise . resolve ( null ) ,
167167 ]
168168 void Promise . all ( tasks ) . then ( ( [ imgUrl , lyrics ] ) => {
169- const lrcData = {
170- lrc : '' ,
171- tlrc : null as string | null ,
172- rlrc : null as string | null ,
173- }
174- if ( lyrics ) {
175- lrcData . lrc = lyrics . lyric
176- if ( appSetting [ 'download.isEmbedLyricT' ] && lyrics . tlyric ) lrcData . tlrc = lyrics . tlyric
177- if ( appSetting [ 'download.isEmbedLyricR' ] && lyrics . rlyric ) lrcData . rlrc = lyrics . rlyric
178- }
179- void window . lx . worker . download . writeMeta ( downloadInfo . metadata . filePath , {
169+ const info = {
170+ filePath : downloadInfo . metadata . filePath ,
171+ isEmbedLyricLx : appSetting [ 'download.isEmbedLyricLx' ] ,
172+ isEmbedLyricT : appSetting [ 'download.isEmbedLyricT' ] ,
173+ isEmbedLyricR : appSetting [ 'download.isEmbedLyricR' ] ,
180174 title : downloadInfo . metadata . musicInfo . name ,
181175 artist : downloadInfo . metadata . musicInfo . singer ?. replaceAll ( '、' , ';' ) ,
182176 album : downloadInfo . metadata . musicInfo . meta . albumName ,
183177 APIC : imgUrl ,
184- } , lrcData , getProxy ( ) )
178+ }
179+ void window . lx . worker . download . writeMeta ( info , lyrics ?? { lyric : '' } , getProxy ( ) )
185180 } )
186181}
187182
@@ -198,14 +193,14 @@ const downloadLyric = (downloadInfo: LX.Download.ListItem) => {
198193 } ) . then ( lrcs => {
199194 if ( lrcs . lyric ) {
200195 lrcs . lyric = fixKgLyric ( lrcs . lyric )
201- const lrcData = {
202- lrc : lrcs . lyric ,
203- tlrc : appSetting [ 'download.isDownloadTLrc' ] && lrcs . tlyric ? lrcs . tlyric : null ,
204- rlrc : appSetting [ 'download.isDownloadRLrc' ] && lrcs . rlyric ? lrcs . rlyric : null ,
196+ const info = {
197+ filePath : downloadInfo . metadata . filePath . substring ( 0 , downloadInfo . metadata . filePath . lastIndexOf ( '.' ) ) + '.lrc' ,
198+ format : appSetting [ 'download.lrcFormat' ] ,
199+ downloadLxlrc : appSetting [ 'download.isDownloadLxLrc' ] ,
200+ downloadTlrc : appSetting [ 'download.isDownloadTLrc' ] ,
201+ downloadRlrc : appSetting [ 'download.isDownloadRLrc' ] ,
205202 }
206- void window . lx . worker . download . saveLrc ( lrcData ,
207- downloadInfo . metadata . filePath . substring ( 0 , downloadInfo . metadata . filePath . lastIndexOf ( '.' ) ) + '.lrc' ,
208- appSetting [ 'download.lrcFormat' ] )
203+ void window . lx . worker . download . saveLrc ( lrcs , info )
209204 }
210205 } )
211206}
0 commit comments