Browse Source

修复不复制的批量音乐标签的入库问题

onecold 9 months ago
parent
commit
ed03e2bd29

+ 10 - 8
entry/src/main/ets/pages/UploadMusicPage.ets

@@ -1669,7 +1669,8 @@ export struct UploadMusicPage {
           })
       }
       .width('100%')
-      .padding(16)
+      .padding({ left:16,right:16 })
+      .margin({bottom:25})
     }
   }
 
@@ -1789,9 +1790,9 @@ export struct UploadMusicPage {
       Row({ space: 10 }) {
         Button({ type: ButtonType.Normal }) {
           Row({ space: 6 }) {
-            Text('📄')
+            Text('📁')
               .fontSize(16)
-            Text('快速选择')
+            Text('从文件管理器')
               .fontSize(14)
               .fontWeight(FontWeight.Medium)
           }
@@ -1813,9 +1814,9 @@ export struct UploadMusicPage {
 
         Button({ type: ButtonType.Normal }) {
           Row({ space: 6 }) {
-            Text('📁')
+            Text('🎵')
               .fontSize(16)
-            Text('浏览选择')
+            Text('从本地目录')
               .fontSize(14)
               .fontWeight(FontWeight.Medium)
           }
@@ -2237,7 +2238,7 @@ export struct UploadMusicPage {
         Button('取消')
           .fontSize(14)
           .height(48)
-          .padding({ left: 20, right: 20 })
+          .padding({ left: 30, right: 30 })
           .backgroundColor(this.isDarkMode ? '#2E3238' : '#E5E5EA')
           .fontColor(this.isDarkMode ? '#E5FFFFFF' : '#1F1F1F')
           .borderRadius(8)
@@ -2248,7 +2249,7 @@ export struct UploadMusicPage {
         Button('确定')
           .fontSize(14)
           .height(48)
-          .padding({ left: 20, right: 20 })
+          .padding({ left: 30, right: 30 })
           .backgroundColor(this.themeColor)
           .fontColor('#FFFFFF')
           .borderRadius(8)
@@ -2259,7 +2260,8 @@ export struct UploadMusicPage {
           })
       }
       .width('100%')
-      .padding(16)
+      .padding({ left:16,right:16 })
+      .margin({bottom:12})
     }
   }
 }

+ 10 - 4
entry/src/main/ets/view/LocalMusic.ets

@@ -3258,8 +3258,10 @@ export struct LocalMusic {
               if (this.modeType ==0||this.modeType==4) {
                 Column() {
                   emptyView(this.themeColor)
-
                 }
+                .onClick(()=>{
+                  this.asyncCurrentPathOnlyFile()
+                })
                 .position({ top: 200 })
                 .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 })
                   .animation({ duration: 500 }),
@@ -3320,9 +3322,9 @@ export struct LocalMusic {
               })
               .onClick(() => {
                 // if(ArrayUtil.isNotEmpty(this.selectedFiles)&&Utility.isMerge(this.selectedFiles,this.packName)){
-                this.isOneKeyTags = !this.isOneKeyTags
+                  this.isOneKeyTags = !this.isOneKeyTags
                 // }else{
-                //   ToastUtil.showToast('选中的文件包含了不是本应用的DownLoad文件下,其他路径音频无权限批量内嵌')
+                //   ToastUtil.showToast('选中的文件包含了不是本应用的DownLoad文件下,其他路径音频无权限批量内嵌标签,导入的时候请勾选复制一份。')
                 // }
 
               })
@@ -3885,7 +3887,11 @@ export struct LocalMusic {
           {
             selectedFiles:this.selectedFiles,
             isOneKeyTags:this.isOneKeyTags,
-            table:this.table,
+            onSeePath:(path:string)=>{
+              this.modeType = 0
+              this.deleteCache(path)
+              this.getSortedFiles(path)
+            },
             onTagsResult:(result: boolean,deleteCache_path?:string)=>{
               this.isMultiSelect = false
               if(result){//如果嵌入成功,更新数据

+ 66 - 54
entry/src/main/ets/view/TagsContentCover.ets

@@ -21,11 +21,13 @@ export struct TagsContentCover {
   private listScroller: ListScroller = new ListScroller()
   onTagsResult = (_result: boolean,deleteCache_path?:string) => {
   }
+  onSeePath = (path:string) => {
+  }
+
   @State isLyric:boolean = true
   @State isCover:boolean = true
   @State download_path:string = ''
   @Link isOneKeyTags: boolean;
-  @Prop table: MediaTable
   @State packName: string = ''
   @State dataSource: LazyDataSource<VideoItem> = new LazyDataSource([])
   @Prop selectedFiles: Array<VideoItem>
@@ -49,13 +51,14 @@ export struct TagsContentCover {
   // 分别跟踪歌词和封面嵌入状态
   @State lyricEmbedStatusMap: Map<string, boolean> = new Map<string, boolean>();
   @State coverEmbedStatusMap: Map<string, boolean> = new Map<string, boolean>();
-
+  @State table: MediaTable  = new MediaTable(this.context);
 
   onColorModeChange() {
     this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
   }
 
   async aboutToAppear() {
+
     this.download_path = PreferencesUtil.getStringSync('download_path')+'批量内嵌'+'/'
     if (!FileUtil.accessSync(this.download_path)) {
       FileUtil.mkdirSync(this.download_path)
@@ -68,6 +71,13 @@ export struct TagsContentCover {
     } else {
       this.dataSource = new LazyDataSource([])
     }
+
+    // 初始化数据库
+    await new Promise<void>((resolve, reject) => {
+      this.table.getRdbStore(this.context,  (err:Error) => {
+        err ? reject(err) : resolve();
+      });
+    });
   }
 
 
@@ -147,7 +157,7 @@ export struct TagsContentCover {
           .fontColor([this.themeColor])
           .alignSelf(ItemAlign.Center)
           .margin({ left: 15 })
-        Text('说明:不是本app路径下的歌曲将在[DownLoad/天天静听/批量内嵌]文件夹中生成新的内嵌歌曲。如果失败可以多试几次。')
+        Text('说明:不是本app路径下的歌曲将在【DownLoad/天天静听/批量内嵌】文件夹中生成新的内嵌歌曲。如果失败可以多试几次。')
           .margin({ left: 5 ,right: 5})
           .fontSize(14)
           .padding({top:4,bottom:4})
@@ -255,15 +265,17 @@ export struct TagsContentCover {
               Text(`正在处理: ${this.currentFileIndex}/${this.totalFiles}`)
                 .fontSize(12)
                 .fontColor($r('app.color.text_color'))
+
+              Text(`${this.currentProgress}%`)
+                .margin({ left: 5 })
+                .fontSize(12)
+                .fontWeight(480)
+                .fontColor($r('app.color.text_color'))
             }
             .width('100%')
             .margin({left:20,right:8})
 
-            Text(`${this.currentProgress}%`)
-              .margin({ left: 5 })
-              .fontSize(15)
-              .fontWeight(480)
-              .fontColor($r('app.color.text_color'))
+
 
             Blank()
 
@@ -626,57 +638,57 @@ export struct TagsContentCover {
           Blank()
           // 歌词嵌入状态
 
-            Row() {
-              Text('歌词')
-                .fontSize(12)
-                .fontColor(this.themeColor)
-              // 只有当状态存在时才显示图标
-                SymbolGlyph(this.lyricEmbedStatusMap.get(item.filePath)?$r('sys.symbol.checkmark_circle'):$r('sys.symbol.xmark_circle'))
-                  .fontSize(16)
-                  .margin({ left: 4 })
-                  .fontColor([this.themeColor])
-                  .alignSelf(ItemAlign.Center)
-                  .visibility(this.lyricEmbedStatusMap.has(item.filePath)?Visibility.Visible:Visibility.Hidden)
-                  .animation({
-                    duration: 666,
-                    curve: 'ease-in-out'
-                  })
-            }
-            .visibility(this.isLyric?Visibility.Visible:Visibility.None)
-            .animation({
-              duration: 666,
-              curve: 'ease-in-out'
-            })
-            .padding({ right:10 })
+          Row() {
+            Text('歌词')
+              .fontSize(12)
+              .fontColor(this.themeColor)
+            // 只有当状态存在时才显示图标
+            SymbolGlyph(this.lyricEmbedStatusMap.get(item.filePath)?$r('sys.symbol.checkmark_circle'):$r('sys.symbol.xmark_circle'))
+              .fontSize(16)
+              .margin({ left: 4 })
+              .fontColor([this.themeColor])
+              .alignSelf(ItemAlign.Center)
+              .visibility(this.lyricEmbedStatusMap.has(item.filePath)?Visibility.Visible:Visibility.Hidden)
+              .animation({
+                duration: 666,
+                curve: 'ease-in-out'
+              })
+          }
+          .visibility(this.isLyric?Visibility.Visible:Visibility.None)
+          .animation({
+            duration: 666,
+            curve: 'ease-in-out'
+          })
+          .padding({ right:10 })
 
 
           // 封面嵌入状态
 
-            Row() {
-              Text('封面')
-                .fontSize(12)
-                .fontColor(this.themeColor)
-              // 只有当状态存在时才显示图标
-
-              SymbolGlyph(this.coverEmbedStatusMap.get(item.filePath)?$r('sys.symbol.checkmark_circle'):$r('sys.symbol.xmark_circle'))
-                .fontSize(16)
-                .margin({ left: 4 })
-                .fontColor([this.themeColor])
-                .alignSelf(ItemAlign.Center)
-                .visibility(this.coverEmbedStatusMap.has(item.filePath)?Visibility.Visible:Visibility.Hidden)
-                .animation({
-                  duration: 666,
-                  curve: 'ease-in-out'
-                })
+          Row() {
+            Text('封面')
+              .fontSize(12)
+              .fontColor(this.themeColor)
+            // 只有当状态存在时才显示图标
 
-            }
-            .margin({ left: 5 })
-            .visibility(this.isCover?Visibility.Visible:Visibility.None)
-            .animation({
-              duration: 666,
-              curve: 'ease-in-out'
-            })
-            .padding({ right: 25 })
+            SymbolGlyph(this.coverEmbedStatusMap.get(item.filePath)?$r('sys.symbol.checkmark_circle'):$r('sys.symbol.xmark_circle'))
+              .fontSize(16)
+              .margin({ left: 4 })
+              .fontColor([this.themeColor])
+              .alignSelf(ItemAlign.Center)
+              .visibility(this.coverEmbedStatusMap.has(item.filePath)?Visibility.Visible:Visibility.Hidden)
+              .animation({
+                duration: 666,
+                curve: 'ease-in-out'
+              })
+
+          }
+          .margin({ left: 5 })
+          .visibility(this.isCover?Visibility.Visible:Visibility.None)
+          .animation({
+            duration: 666,
+            curve: 'ease-in-out'
+          })
+          .padding({ right: 25 })
 
 
         }