ソースを参照

修复内嵌标签报错的bug

onecold 9 ヶ月 前
コミット
68efb1d0df

+ 3 - 2
entry/src/main/ets/common/util/MediaTable.ets

@@ -237,7 +237,7 @@ export default  class MediaTable {
       callback(false);
       return false;
     }
-
+    console.info('onecold filePath updateMediaInfo= '+filePath)
     // Step 1: Create a predicate to find the record by filePath
     const predicates = new relationalStore.RdbPredicates(RdbUtils.MEDIA_TABLE.tableName);
     predicates.equalTo('filePath', filePath);
@@ -246,11 +246,12 @@ export default  class MediaTable {
     this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
       if (resultSet.rowCount === 0) {
         Logger.info(RdbUtils.RDB_TAG, `No record found with filePath ${filePath}.`);
+        console.info('onecold No record found with filePath '+filePath)
         callback(false);
         resultSet.close();
         return;
       }
-
+      console.info('onecold filePath updateMediaInfo1= '+filePath)
       // Step 3: Prepare the values to update
       const valuesToUpdate: relationalStore.ValuesBucket = {};
       if (title !== '') {

+ 1 - 1
entry/src/main/ets/common/util/RdbUtils.ets

@@ -394,7 +394,7 @@ export default class RdbUtils {
           callback(resFlag);
           return;
         }
-        Logger.info(RdbUtils.RDB_TAG, `updateData() finished: ${ret}`);
+        console.info( `onecold updateData() finished: ${ret}`);
         callback(!resFlag);
       });
     }

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

@@ -1349,11 +1349,9 @@ export struct LocalMusic {
       }
 
       console.info(`onecold gengxin 1: ${this.videoLocalList.length}`);
-      // for (let i = 0; i < this.videoLocalList.length; i++) {
-      //
-      //   console.info(`onecold gengxin 1: ${this.videoLocalList[i].pixelMapPath}`);
-      //
-      // }
+      for (let i = 0; i < this.videoLocalList.length; i++) {
+        console.info(`onecold gengxin 1: ${this.videoLocalList[i].name}`);
+      }
 
       // this.setButtonStatus()
       this.openMusic(isOpen, destPath,openItem)
@@ -6495,6 +6493,7 @@ export struct LocalMusic {
       const task = new taskpool.Task(
         updateInfoDb,
         this.context,
+        item.filePath,
         this.titleStr,
         this.artistStr,
         this.ablumStr,
@@ -6502,7 +6501,7 @@ export struct LocalMusic {
         this.yearStr,this.genreStr,
         this.trackStr,this.albumArtistStr,
         this.composerStr, this.lyricistStr,
-        this.commentStr,this.discStr,
+        this.commentStr,this.discStr
       );
       taskpool.execute(task, taskpool.Priority.HIGH).then((result) => {
         if (result) {
@@ -14319,6 +14318,11 @@ async function updateInfoDb(
   discStr: string,
 ): Promise<boolean> {
   const table: MediaTable = new MediaTable(context);
+  await new Promise<void>((resolve, reject) => {
+    table.getRdbStore(context,  (err:Error) => {
+      err ? reject(err) : resolve();
+    });
+  });
 
   return table.updateMediaInfo(filePath, titleStr, artistStr, albumStr, lyricConStr,
     yearStr, genreStr, trackStr, albumArtistStr, composerStr, lyricistStr, commentStr, discStr,