|
@@ -1016,7 +1016,7 @@ export struct LocalMusic {
|
|
|
case 101: //第一次扫描文件夹入库
|
|
case 101: //第一次扫描文件夹入库
|
|
|
ToastUtil.showToast('刷新同步数据库成功!')
|
|
ToastUtil.showToast('刷新同步数据库成功!')
|
|
|
Logger.info('onecold 扫描数据库结束 this.mediaKuList length= ' + this.mediaKuList.length)
|
|
Logger.info('onecold 扫描数据库结束 this.mediaKuList length= ' + this.mediaKuList.length)
|
|
|
- this.doUpdateData()
|
|
|
|
|
|
|
+ this.doAllUpdateData()
|
|
|
break;
|
|
break;
|
|
|
case 102: //查询媒体库列表
|
|
case 102: //查询媒体库列表
|
|
|
this.isRefreshing = false
|
|
this.isRefreshing = false
|
|
@@ -1384,8 +1384,8 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
if(openItem){
|
|
if(openItem){
|
|
|
this.doPlay(openItem,0,false,true)
|
|
this.doPlay(openItem,0,false,true)
|
|
|
- this.isShowPlay = true
|
|
|
|
|
- // this.setShowPlayTrue()
|
|
|
|
|
|
|
+ // this.isShowPlay = true
|
|
|
|
|
+ this.setShowPlayTrue()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -6394,6 +6394,19 @@ export struct LocalMusic {
|
|
|
@State discStr: string = ''
|
|
@State discStr: string = ''
|
|
|
|
|
|
|
|
doUpdateData() {
|
|
doUpdateData() {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+
|
|
|
|
|
+ if (this.modeType === 0) {
|
|
|
|
|
+ this.deleteCache(this.currentPath)
|
|
|
|
|
+ this.getSortedFiles(this.currentPath)
|
|
|
|
|
+ }else if (this.modeType === 1){
|
|
|
|
|
+ workerInstance.postMessage({ code: 2, data: this.context,data2:this.packName });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }, 999)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ doAllUpdateData() {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
if (this.modeType === 0) {
|
|
if (this.modeType === 0) {
|
|
@@ -6403,6 +6416,7 @@ export struct LocalMusic {
|
|
|
workerInstance.postMessage({ code: 2, data: this.context,data2:this.packName });
|
|
workerInstance.postMessage({ code: 2, data: this.context,data2:this.packName });
|
|
|
workerInstance.postMessage({ code: 3, data: this.context });
|
|
workerInstance.postMessage({ code: 3, data: this.context });
|
|
|
workerInstance.postMessage({ code: 4, data: this.context });
|
|
workerInstance.postMessage({ code: 4, data: this.context });
|
|
|
|
|
+
|
|
|
}, 999)
|
|
}, 999)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -6477,45 +6491,57 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- this.table.updateMediaInfo(item.filePath, this.titleStr, this.artistStr, this.ablumStr,this.lyricConStr,
|
|
|
|
|
- this.yearStr,this.genreStr,this.trackStr,this.albumArtistStr,this.composerStr, this.lyricistStr,this.commentStr,this.discStr,
|
|
|
|
|
- (success: boolean, error?: string) => {
|
|
|
|
|
- // this.isShowEdit = false
|
|
|
|
|
|
|
|
|
|
- if (success) {
|
|
|
|
|
- console.log(" onecold 编辑信息成功,数据库已同步");
|
|
|
|
|
- ToastUtil.showToast('内嵌音乐标签成功')
|
|
|
|
|
- this.isShowMoreView = false
|
|
|
|
|
- this.name = this.titleStr
|
|
|
|
|
- if (item.filePath == this.currentSong?.filePath) {
|
|
|
|
|
- this.currentSong.name = this.titleStr
|
|
|
|
|
- this.artist = this.artistStr
|
|
|
|
|
- this.currentSong.artist = this.artistStr
|
|
|
|
|
- this.currentSong.album = this.ablumStr
|
|
|
|
|
- this.currentSong.year = this.yearStr
|
|
|
|
|
- this.currentSong.genre = this.genreStr
|
|
|
|
|
- this.currentSong.track = this.trackStr
|
|
|
|
|
- this.currentSong.lyricContent = this.lyricConStr
|
|
|
|
|
- this.initLyric(item.filePath)
|
|
|
|
|
-
|
|
|
|
|
- this.currentSong.ALBUMARTIST = this.albumArtistStr
|
|
|
|
|
- this.currentSong.COMPOSER = this.composerStr
|
|
|
|
|
- this.currentSong.LYRICIST = this.lyricistStr
|
|
|
|
|
- this.currentSong.COMMENT = this.commentStr
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.doUpdateData()
|
|
|
|
|
- } else {
|
|
|
|
|
- // ToastUtil.showToast('保存失败' + error?.toString())
|
|
|
|
|
- console.error(" onecold 编辑信息数据库失败原因: " + error);
|
|
|
|
|
|
|
+ const task = new taskpool.Task(
|
|
|
|
|
+ updateInfoDb,
|
|
|
|
|
+ this.context,
|
|
|
|
|
+ this.titleStr,
|
|
|
|
|
+ this.artistStr,
|
|
|
|
|
+ this.ablumStr,
|
|
|
|
|
+ this.lyricConStr,
|
|
|
|
|
+ this.yearStr,this.genreStr,
|
|
|
|
|
+ this.trackStr,this.albumArtistStr,
|
|
|
|
|
+ this.composerStr, this.lyricistStr,
|
|
|
|
|
+ this.commentStr,this.discStr,
|
|
|
|
|
+ );
|
|
|
|
|
+ taskpool.execute(task, taskpool.Priority.HIGH).then((result) => {
|
|
|
|
|
+ if (result) {
|
|
|
|
|
+ console.log(" onecold 编辑信息成功,数据库已同步");
|
|
|
|
|
+ ToastUtil.showToast('内嵌音乐标签成功')
|
|
|
|
|
+ this.isShowMoreView = false
|
|
|
|
|
+ this.name = this.titleStr
|
|
|
|
|
+ if (item.filePath == this.currentSong?.filePath) {
|
|
|
|
|
+ this.currentSong.name = this.titleStr
|
|
|
|
|
+ this.artist = this.artistStr
|
|
|
|
|
+ this.currentSong.artist = this.artistStr
|
|
|
|
|
+ this.currentSong.album = this.ablumStr
|
|
|
|
|
+ this.currentSong.year = this.yearStr
|
|
|
|
|
+ this.currentSong.genre = this.genreStr
|
|
|
|
|
+ this.currentSong.track = this.trackStr
|
|
|
|
|
+ this.currentSong.lyricContent = this.lyricConStr
|
|
|
|
|
+ this.initLyric(item.filePath)
|
|
|
|
|
+
|
|
|
|
|
+ this.currentSong.ALBUMARTIST = this.albumArtistStr
|
|
|
|
|
+ this.currentSong.COMPOSER = this.composerStr
|
|
|
|
|
+ this.currentSong.LYRICIST = this.lyricistStr
|
|
|
|
|
+ this.currentSong.COMMENT = this.commentStr
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 关闭进度条
|
|
|
|
|
- DialogHelper.closeLoading();
|
|
|
|
|
- });
|
|
|
|
|
- console.log(' onecold 元数据标签更新成功,');
|
|
|
|
|
|
|
+ this.doUpdateData()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // ToastUtil.showToast('保存失败' + error?.toString())
|
|
|
|
|
+ console.error(" onecold 编辑信息数据库失败 ");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }).catch((error: Error) => {
|
|
|
|
|
+ console.error('onecold Subtitle sync failed:', error);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ console.log(' onecold 元数据标签更新成功,');
|
|
|
|
|
+
|
|
|
|
|
+ // 关闭进度条
|
|
|
|
|
+ DialogHelper.closeLoading();
|
|
|
} else {
|
|
} else {
|
|
|
// 关闭进度条
|
|
// 关闭进度条
|
|
|
DialogHelper.closeLoading();
|
|
DialogHelper.closeLoading();
|
|
@@ -14273,3 +14299,34 @@ async function scanCurrentDirectoryTask(context: Context, dirPath: string, lockP
|
|
|
console.error(' 扫描当前目录失败:', error);
|
|
console.error(' 扫描当前目录失败:', error);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+//内嵌标签后更新库
|
|
|
|
|
+@Concurrent
|
|
|
|
|
+async function updateInfoDb(
|
|
|
|
|
+ context: Context,
|
|
|
|
|
+ filePath: string,
|
|
|
|
|
+ titleStr: string,
|
|
|
|
|
+ artistStr: string,
|
|
|
|
|
+ albumStr: string,
|
|
|
|
|
+ lyricConStr: string,
|
|
|
|
|
+ yearStr: string,
|
|
|
|
|
+ genreStr: string,
|
|
|
|
|
+ trackStr: string,
|
|
|
|
|
+ albumArtistStr: string,
|
|
|
|
|
+ composerStr: string,
|
|
|
|
|
+ lyricistStr: string,
|
|
|
|
|
+ commentStr: string,
|
|
|
|
|
+ discStr: string,
|
|
|
|
|
+): Promise<boolean> {
|
|
|
|
|
+ const table: MediaTable = new MediaTable(context);
|
|
|
|
|
+
|
|
|
|
|
+ return table.updateMediaInfo(filePath, titleStr, artistStr, albumStr, lyricConStr,
|
|
|
|
|
+ yearStr, genreStr, trackStr, albumArtistStr, composerStr, lyricistStr, commentStr, discStr,
|
|
|
|
|
+ (success: boolean, error?: string) => {
|
|
|
|
|
+ if (success) {
|
|
|
|
|
+ console.log("onecold 编辑信息成功,数据库已同步");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.error("onecold 编辑信息数据库失败原因: " + error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|