File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ const items: Item[] = [
4848 { label: " 歌曲百科" , key: " wiki" },
4949 { label: " 搜索" , key: " search" },
5050 { label: " 下载" , key: " download" },
51+ { label: " 复制歌曲名称" , key: " copyName" },
52+ { label: " 音乐标签编辑" , key: " musicTagEditor" },
5153];
5254
5355const updateSetting = (key : ContextMenuOptionKey , val : boolean ) => {
Original file line number Diff line number Diff line change @@ -230,6 +230,7 @@ export const useSongMenu = () => {
230230 {
231231 key : "code-name" ,
232232 label : `复制${ type === "song" ? "歌曲" : type === "streaming" ? "流媒体" : "节目" } 名称` ,
233+ show : settingStore . contextMenuOptions . copyName ,
233234 props : {
234235 onClick : ( ) => copyData ( song . name ) ,
235236 } ,
@@ -257,12 +258,12 @@ export const useSongMenu = () => {
257258 {
258259 key : "line-2" ,
259260 type : "divider" ,
260- show : isLocal ,
261+ show : settingStore . contextMenuOptions . musicTagEditor && isLocal ,
261262 } ,
262263 {
263264 key : "meta-edit" ,
264265 label : "音乐标签编辑" ,
265- show : isLocal ,
266+ show : settingStore . contextMenuOptions . musicTagEditor && isLocal ,
266267 props : {
267268 onClick : ( ) => {
268269 if ( song . path ) openSongInfoEditor ( song ) ;
Original file line number Diff line number Diff line change @@ -551,19 +551,20 @@ class DownloadManager {
551551 }
552552 }
553553
554- // 如果进行了合并,或者原本就是 YRC/TTML ,我们重新生成标准 TTML
555- // 这样可以确保翻译被正确嵌入
556- if ( merged || ttmlLyric || yrcLyric ) {
554+ // 如果进行了合并,或者原本就是 YRC (需要转换) ,我们重新生成标准 TTML
555+ // 注意:如果是 TTML 且未合并,不要重新生成,以免丢失原始内容
556+ if ( ( merged || yrcLyric ) && lines . length > 0 ) {
557557 content = lyricLinesToTTML ( lines ) ;
558+ console . log ( "[Download] Generated new TTML content from lines." ) ;
558559 }
559560 }
560561
561562 // 繁体转换
562563 content = await this . _convertToTraditionalIfNeeded ( content ) ;
563564
564565 // 如果进行了合并或转换,统一保存为 ttml (因为我们生成的是 standard TTML)
565- // 除非原本就是 yrc 且没合并
566- const ext = ( ttmlLyric || merged ) ? "ttml" : "yrc" ;
566+ // 只要解析出了 lines (说明是 YRC 转换或进行了合并),或者是原生 TTML,都保存为 ttml
567+ const ext = ( ttmlLyric || lines . length > 0 ) ? "ttml" : "yrc" ;
567568 const fileName = `${ safeFileName } .${ ext } ` ;
568569 const encoding = settingStore . downloadLyricEncoding || "utf-8" ;
569570
@@ -572,7 +573,7 @@ class DownloadManager {
572573 content = content . replace ( / e n c o d i n g = [ " ' ] u t f - 8 [ " ' ] / i, `encoding="${ encoding } "` ) ;
573574 }
574575
575- console . log ( `[Download] Saving extra lyric file: ${ fileName } ` ) ;
576+ console . log ( `[Download] Saving extra lyric file: ${ fileName } , content len: ${ content . length } ` ) ;
576577 // 调用保存文件内容接口
577578 const saveRes = await window . electron . ipcRenderer . invoke ( "save-file-content" , {
578579 path : targetPath ,
Original file line number Diff line number Diff line change @@ -404,6 +404,8 @@ export interface SettingState {
404404 wiki : boolean ;
405405 search : boolean ;
406406 download : boolean ;
407+ copyName : boolean ;
408+ musicTagEditor : boolean ;
407409 } ;
408410 /** 启用搜索关键词获取 */
409411 enableSearchKeyword : boolean ;
@@ -683,6 +685,8 @@ export const useSettingStore = defineStore("setting", {
683685 wiki : true ,
684686 search : true ,
685687 download : true ,
688+ copyName : true ,
689+ musicTagEditor : true ,
686690 } ,
687691 enableSearchKeyword : true ,
688692 clearSearchOnBlur : false ,
You can’t perform that action at this time.
0 commit comments