chendeben 9 mesi fa
parent
commit
c7aea4bca2

+ 0 - 1
entry/src/main/ets/common/util/MediaTable.ets

@@ -732,7 +732,6 @@ export default  class MediaTable {
       safeGetNumber(DB_COLUMNS.TYPE),
       safeGetNumber(DB_COLUMNS.VIDEO_SIZE),
       safeGet(DB_COLUMNS.C_TIME),
-      undefined,
       safeGet(DB_COLUMNS.SIZE),
       safeGet(DB_COLUMNS.PIXEL_MAP_PATH),
       safeGet(DB_COLUMNS.ARTIST),

+ 15 - 2
entry/src/main/ets/common/util/RdbUtils.ets

@@ -51,7 +51,6 @@ export default class RdbUtils {
       '        parentPath TEXT,\n' +
       '        isFav INTEGER,\n' +
       '        pixelMapPath TEXT,\n' +
-      '        pixelMapToString TEXT,\n' +
       '        duration TEXT,\n' +
       '        sampleRate TEXT,\n' +
       '        playCount INTEGER DEFAULT 0,\n' +
@@ -86,7 +85,7 @@ export default class RdbUtils {
       '        mimeType TEXT' +
       ')',
     columns: ['id', 'name', 'filePath','mtype', 'videoSize', 'cTime','size', 'artist', 'album',
-      'fileName','parentPath','isFav','pixelMapPath','pixelMapToString',
+      'fileName','parentPath','isFav','pixelMapPath',
       'duration',   'sampleRate','playCount',  'lastPlayedStr', 'trackCount',
       'lyricContent','md5Str','extra_json','pyStr','bit_rate','probe_score','year','nb_streams','nb_programs',
       'genre','track',  'bits_per_raw_sample','channels',  'channel_layout','start_time',
@@ -247,6 +246,20 @@ export default class RdbUtils {
               }
             }
 
+            // 移除废弃的 pixelMapToString 列
+            const dropPixelMapSql = `ALTER TABLE ${this.tableName} DROP COLUMN pixelMapToString`;
+            try {
+              this.rdbStore.executeSql(dropPixelMapSql)
+                .then(() => {
+                  Logger.info(RdbUtils.RDB_TAG, '已删除废弃列 pixelMapToString');
+                })
+                .catch(() => {
+                  // 列不存在或数据库版本不支持 DROP COLUMN,忽略
+                });
+            } catch (dropErr) {
+              Logger.warn(RdbUtils.RDB_TAG, `移除 pixelMapToString 列失败: ${(dropErr as Error).message}`);
+            }
+
             // 设置数据库版本
             if (this.rdbStore) {
               this.rdbStore.version = 1;

+ 1 - 5
entry/src/main/ets/common/util/RemoteDriveManager.ets

@@ -985,7 +985,6 @@ export class RemoteDriveManager {
     target.duration = cached.duration || target.duration;
     target.size = cached.size || target.size;
     target.pixelMapPath = cached.pixelMapPath || target.pixelMapPath;
-    target.pixelMap = cached.pixelMap || target.pixelMap;
     target.lyricContent = cached.lyricContent || target.lyricContent;
     target.md5Str = cached.md5Str || target.md5Str;
     target.bit_rate = cached.bit_rate || target.bit_rate;
@@ -1016,7 +1015,7 @@ export class RemoteDriveManager {
     const absoluteUrl = `${protocol}://${host}:${port}${encodedHref}`;
 
     // 创建VideoItem对象
-    // 构造函数签名: (name, id, filePath, type, videoSize, cTime, pixelMap?, size?, pixelMapPath?, artist?, album?, fileName?, lastPlayed?)
+    // 构造函数签名: (name, id, filePath, type, videoSize, cTime, size?, pixelMapPath?, artist?, album?, fileName?, lastPlayed?)
 
     const videoItem = new VideoItem(
       this.getFileNameWithoutExtension(fileInfo.fileName), // name: 歌曲名
@@ -1025,7 +1024,6 @@ export class RemoteDriveManager {
       CommonConstants.TYPE_WEBDAV, // type: WebDAV类型
       fileInfo.contentLength, // videoSize: 文件大小
       Utility.getFormatDateStr(fileInfo.time,'yyyy-MM-dd HH:mm'), // cTime: 修改时间
-      undefined, // pixelMap
       undefined, // size
       undefined, // pixelMapPath: 对于WebDAV歌曲不设置图片路径
       Constants.UNKNOWN_ARTIST, // artist: 艺术家
@@ -1071,7 +1069,6 @@ export class RemoteDriveManager {
       Utility.getFormatDateStr(fileInfo.time, 'yyyy-MM-dd HH:mm'),
       undefined,
       undefined,
-      undefined,
       Constants.UNKNOWN_ARTIST,
       undefined,
       fileInfo.fileName
@@ -1162,7 +1159,6 @@ export class RemoteDriveManager {
       CommonConstants.TYPE_NAVIDROME,
       song.size ?? 0,
       Utility.getFormatDateStr(Date.now(), 'yyyy-MM-dd HH:mm'),
-      undefined,
       Utility.formatFSize(song.size ?? 0),
       undefined,
       song.artist ?? album?.artist ?? Constants.UNKNOWN_ARTIST,

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

@@ -838,7 +838,7 @@ export class Utility {
         if(musicName==undefined)
           musicName = file.name
 
-        item = new VideoItem(musicName,uri ,uri,type,videoSize,addTime,undefined,fileSize,
+        item = new VideoItem(musicName,uri ,uri,type,videoSize,addTime,fileSize,
           imagePath,artist,album,file.name)
         item.duration = duration+'';
         item.mimeType = mimeType;

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

@@ -343,15 +343,14 @@ export struct WebDavMainPage {
       item.name,
       item.id,
       item.filePath,
-      item.type,
-      item.videoSize,
-      item.cTime,
-      item.pixelMap,
-      item.size,
-      item.pixelMapPath,
-      item.artist,
-      item.album,
-      item.fileName,
+    item.type,
+    item.videoSize,
+    item.cTime,
+    item.size,
+    item.pixelMapPath,
+    item.artist,
+    item.album,
+    item.fileName,
       item.lastPlayed
     );
     clone.duration = item.duration;
@@ -365,7 +364,6 @@ export struct WebDavMainPage {
     clone.album = item.album;
     clone.lyricContent = item.lyricContent;
     clone.pixelMapPath = item.pixelMapPath;
-    clone.pixelMap = item.pixelMap;
     clone.cTime = item.cTime;
     clone.fileName = item.fileName;
     clone.md5Str = item.md5Str;

+ 0 - 5
entry/src/main/ets/view/LocalMusic.ets

@@ -369,7 +369,6 @@ function cloneVideoItem(item: VideoItem): VideoItem {
     item.type,
     item.videoSize,
     item.cTime,
-    item.pixelMap,
     item.size,
     item.pixelMapPath,
     item.artist,
@@ -379,7 +378,6 @@ function cloneVideoItem(item: VideoItem): VideoItem {
   );
   copy.parentPath = item.parentPath;
   copy.isFav = item.isFav;
-  copy.pixelMap = item.pixelMap;
   copy.size = item.size;
   copy.pixelMapPath = item.pixelMapPath;
   copy.artist = item.artist;
@@ -1673,9 +1671,6 @@ export struct LocalMusic {
     this.assignNumberMetadata(target, 'probe_score', source.probe_score);
     this.assignNumberMetadata(target, 'nb_streams', source.nb_streams);
     this.assignNumberMetadata(target, 'nb_programs', source.nb_programs);
-    if (source.pixelMap && !target.pixelMap) {
-      target.pixelMap = source.pixelMap;
-    }
     if (source.remote_rel_path && StrUtil.isEmpty(target.remote_rel_path)) {
       target.remote_rel_path = source.remote_rel_path;
     }

+ 3 - 5
entry/src/main/ets/viewmodel/HomeVideoListModel.ets

@@ -13,7 +13,6 @@
  * limitations under the License.
  */
 
-import { image } from '@kit.ImageKit';
 import { resourceManager } from '@kit.LocalizationKit';
 import { VideoItem } from './VideoItem';
 import { VIDEO_DATA } from '../common/constants/CommonConstants';
@@ -51,12 +50,11 @@ export class HomeVideoListModel {
    * Scan the internet video.
    *
    * @param name Video Name.
-   * @param pixelMap pixelMap object.
    * @param src Playback Path.
    * @return Network video list data.
    */
-  async setInternetVideo(name: string, src: string, pixelMap?: image.PixelMap) {
-    this.videoInternetList.push(new VideoItem(name, '', src, 0,pixelMap));
+  async setInternetVideo(name: string, src: string) {
+    this.videoInternetList.push(new VideoItem(name, '', src, 0));
     let videoInternetList = this.videoInternetList;
     GlobalContext.getContext().setObject('videoInternetList', videoInternetList);
     return videoInternetList;
@@ -65,4 +63,4 @@ export class HomeVideoListModel {
 
 let homeVideoListModel = new HomeVideoListModel();
 
-export default homeVideoListModel as HomeVideoListModel;
+export default homeVideoListModel as HomeVideoListModel;

+ 1 - 4
entry/src/main/ets/viewmodel/VideoItem.ets

@@ -13,7 +13,6 @@
  * limitations under the License.
  */
 
-import { image } from '@kit.ImageKit';
 import { FileUtil, StrUtil } from '@pura/harmony-utils';
 import { CommonConstants } from '../common/constants/CommonConstants';
 
@@ -29,7 +28,6 @@ export class VideoItem  {
   cTime:string;//创建时间
   parentPath:string;
   isFav:number;
-  pixelMap?: image.PixelMap;
   size?:string;
   pixelMapPath?: string;
   artist?: string;
@@ -71,7 +69,7 @@ export class VideoItem  {
   webdav_account_id?: string// WebDAV账号ID,用于获取认证信息
   remote_rel_path?: string // 远程相对路径(去掉协议+host+端口),便于重构URL
 
-  constructor(name: string, id: string, filePath: string, type:number,videoSize:number,cTime: string,pixelMap?: image.PixelMap,
+  constructor(name: string, id: string, filePath: string, type:number,videoSize:number,cTime: string,
     size?: string,pixelMapPath?: string,artist?: string,album?: string,fileName?: string, lastPlayed?:Date) {
     this.name = name;
     this.id = id;
@@ -89,7 +87,6 @@ export class VideoItem  {
       this.parentPath = ''
     }
     this.isFav = 0;
-    this.pixelMap = pixelMap;
     this.size = size;
     this.pixelMapPath = pixelMapPath;
 

+ 2 - 0
entry/src/main/ets/workers/Worker.ets

@@ -577,6 +577,7 @@ async function handleEditMusic(payload: EditMusicRequestPayload): Promise<void>
  * @param event message data
  */
 workerPort.onmessageerror = (event: MessageEvents) => {
+  Logger.error('Worker 收到无法反序列化的消息: ' + JSON.stringify(event?.data ?? {}));
 };
 
 /**
@@ -586,4 +587,5 @@ workerPort.onmessageerror = (event: MessageEvents) => {
  * @param event error message
  */
 workerPort.onerror = (event: ErrorEvent) => {
+  Logger.error('Worker 线程执行异常: ' + (event?.message ?? 'unknown error'));
 };