|
@@ -80,6 +80,7 @@ import { BreakpointType, BreakpointTypeEnum } from '../common/util/BreakpointSys
|
|
|
import { resourceManager } from '@kit.LocalizationKit';
|
|
import { resourceManager } from '@kit.LocalizationKit';
|
|
|
import { deviceInfo } from '@kit.BasicServicesKit';
|
|
import { deviceInfo } from '@kit.BasicServicesKit';
|
|
|
import { ensureSmbFileCached } from '../common/network/SmbFileCache';
|
|
import { ensureSmbFileCached } from '../common/network/SmbFileCache';
|
|
|
|
|
+import { findWebDavCacheIfExists, triggerWebDavCacheDownload } from '../common/network/WebDavFileCache';
|
|
|
import { navidromeApi } from '../common/network/NavidromeApi';
|
|
import { navidromeApi } from '../common/network/NavidromeApi';
|
|
|
|
|
|
|
|
import { HSBColorPicker, HSBColorPickerLayout } from '@keke/color-picker'
|
|
import { HSBColorPicker, HSBColorPickerLayout } from '@keke/color-picker'
|
|
@@ -232,6 +233,63 @@ function extractSmbRelativePath(song: VideoItem, shareNameOverride?: string): st
|
|
|
return remainder;
|
|
return remainder;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const workerInstance = new worker.ThreadWorker("entry/ets/workers/Worker.ets");
|
|
|
|
|
+
|
|
|
|
|
+interface MetadataExtractionOptions {
|
|
|
|
|
+ context?: common.Context;
|
|
|
|
|
+ autoParseMusicName?: boolean;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+interface WorkerMetadataPayload {
|
|
|
|
|
+ originFilePath: string;
|
|
|
|
|
+ originId?: string;
|
|
|
|
|
+ bit_rate?: string;
|
|
|
|
|
+ duration?: string;
|
|
|
|
|
+ sampleRate?: string;
|
|
|
|
|
+ mimeType?: string;
|
|
|
|
|
+ md5Str?: string;
|
|
|
|
|
+ videoSize?: number;
|
|
|
|
|
+ size?: string;
|
|
|
|
|
+ pixelMapPath?: string;
|
|
|
|
|
+ artist?: string;
|
|
|
|
|
+ album?: string;
|
|
|
|
|
+ name?: string;
|
|
|
|
|
+ error?: string;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const metadataExtractionInFlight: Set<string> = new Set();
|
|
|
|
|
+
|
|
|
|
|
+function scheduleMetadataExtractionFromCache(
|
|
|
|
|
+ song: VideoItem,
|
|
|
|
|
+ cachePath: string,
|
|
|
|
|
+ options?: MetadataExtractionOptions
|
|
|
|
|
+): void {
|
|
|
|
|
+ if (!song || !cachePath || !song.filePath || !options || !options.context) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!isRemoteCloudType(song.type ?? -1)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (metadataExtractionInFlight.has(song.filePath)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (song.bit_rate && song.sampleRate && song.duration) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ metadataExtractionInFlight.add(song.filePath);
|
|
|
|
|
+ workerInstance.postMessage({
|
|
|
|
|
+ code: 5,
|
|
|
|
|
+ data: options.context,
|
|
|
|
|
+ data2: cachePath,
|
|
|
|
|
+ data3: song.type,
|
|
|
|
|
+ data4: {
|
|
|
|
|
+ originFilePath: song.filePath,
|
|
|
|
|
+ originId: song.id,
|
|
|
|
|
+ autoParseMusicName: options.autoParseMusicName ?? false
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function sanitizePlaybackUrl(rawUrl: string | null | undefined): string {
|
|
function sanitizePlaybackUrl(rawUrl: string | null | undefined): string {
|
|
|
if (!rawUrl) {
|
|
if (!rawUrl) {
|
|
|
return '';
|
|
return '';
|
|
@@ -248,6 +306,60 @@ function sanitizePlaybackUrl(rawUrl: string | null | undefined): string {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function cloneVideoItem(item: VideoItem): VideoItem {
|
|
|
|
|
+ const copy = new VideoItem(
|
|
|
|
|
+ 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.lastPlayed
|
|
|
|
|
+ );
|
|
|
|
|
+ copy.parentPath = item.parentPath;
|
|
|
|
|
+ copy.isFav = item.isFav;
|
|
|
|
|
+ copy.pixelMap = item.pixelMap;
|
|
|
|
|
+ copy.size = item.size;
|
|
|
|
|
+ copy.pixelMapPath = item.pixelMapPath;
|
|
|
|
|
+ copy.artist = item.artist;
|
|
|
|
|
+ copy.album = item.album;
|
|
|
|
|
+ copy.duration = item.duration;
|
|
|
|
|
+ copy.mimeType = item.mimeType;
|
|
|
|
|
+ copy.sampleRate = item.sampleRate;
|
|
|
|
|
+ copy.trackCount = item.trackCount;
|
|
|
|
|
+ copy.lastPlayedStr = item.lastPlayedStr;
|
|
|
|
|
+ copy.playCount = item.playCount;
|
|
|
|
|
+ copy.lyricContent = item.lyricContent;
|
|
|
|
|
+ copy.md5Str = item.md5Str;
|
|
|
|
|
+ copy.extra_json = item.extra_json;
|
|
|
|
|
+ copy.pyStr = item.pyStr;
|
|
|
|
|
+ copy.bit_rate = item.bit_rate;
|
|
|
|
|
+ copy.probe_score = item.probe_score;
|
|
|
|
|
+ copy.year = item.year;
|
|
|
|
|
+ copy.nb_streams = item.nb_streams;
|
|
|
|
|
+ copy.nb_programs = item.nb_programs;
|
|
|
|
|
+ copy.genre = item.genre;
|
|
|
|
|
+ copy.track = item.track;
|
|
|
|
|
+ copy.bits_per_raw_sample = item.bits_per_raw_sample;
|
|
|
|
|
+ copy.channels = item.channels;
|
|
|
|
|
+ copy.channel_layout = item.channel_layout;
|
|
|
|
|
+ copy.start_time = item.start_time;
|
|
|
|
|
+ copy.ALBUMARTIST = item.ALBUMARTIST;
|
|
|
|
|
+ copy.COMPOSER = item.COMPOSER;
|
|
|
|
|
+ copy.LYRICIST = item.LYRICIST;
|
|
|
|
|
+ copy.COMMENT = item.COMMENT;
|
|
|
|
|
+ copy.disc = item.disc;
|
|
|
|
|
+ copy.webdav_account_id = item.webdav_account_id;
|
|
|
|
|
+ copy.remote_rel_path = item.remote_rel_path;
|
|
|
|
|
+ return copy;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 异步设置videoUrl的辅助方法,处理WebDAV URL的构建
|
|
* 异步设置videoUrl的辅助方法,处理WebDAV URL的构建
|
|
|
* @param song 歌曲对象
|
|
* @param song 歌曲对象
|
|
@@ -259,17 +371,48 @@ function sanitizePlaybackUrl(rawUrl: string | null | undefined): string {
|
|
|
* @param song 歌曲对象
|
|
* @param song 歌曲对象
|
|
|
* @returns Promise<string> 完整的URL
|
|
* @returns Promise<string> 完整的URL
|
|
|
*/
|
|
*/
|
|
|
-async function setVideoUrlForSong(song: VideoItem): Promise<string> {
|
|
|
|
|
|
|
+async function setVideoUrlForSong(song: VideoItem, options?: MetadataExtractionOptions): Promise<string> {
|
|
|
|
|
+ const metadataOptions = options ?? {};
|
|
|
if (isWebDavType(song.type) && song.webdav_account_id) {
|
|
if (isWebDavType(song.type) && song.webdav_account_id) {
|
|
|
try {
|
|
try {
|
|
|
- Logger.info(TAG, `WebDAV完整URL构建成功remote_rel_path: ${song.remote_rel_path}`);
|
|
|
|
|
- Logger.info(TAG, `WebDAV完整URL构建成功song.filePath: ${song.filePath}`);
|
|
|
|
|
|
|
+ Logger.info(TAG, `WebDAV 路径信息 remote_rel_path: ${song.remote_rel_path}`);
|
|
|
|
|
+ Logger.info(TAG, `WebDAV 路径信息 filePath: ${song.filePath}`);
|
|
|
const relativePath = song.remote_rel_path || song.filePath;
|
|
const relativePath = song.remote_rel_path || song.filePath;
|
|
|
- const fullUrl = await WebDavUrlUtil.buildFullUrlByAccountId(song.webdav_account_id, relativePath);
|
|
|
|
|
- if (fullUrl) {
|
|
|
|
|
- Logger.info(TAG, `WebDAV完整URL构建成功: ${fullUrl}`);
|
|
|
|
|
- return sanitizePlaybackUrl(fullUrl);
|
|
|
|
|
|
|
+ const manager = RemoteDriveManager.getInstance();
|
|
|
|
|
+ const account = await manager.getWebDavAccountById(song.webdav_account_id);
|
|
|
|
|
+
|
|
|
|
|
+ if (account) {
|
|
|
|
|
+ const cachePath = await findWebDavCacheIfExists(account, relativePath);
|
|
|
|
|
+ if (cachePath) {
|
|
|
|
|
+ Logger.info(TAG, `WebDAV 缓存命中,直接播放: ${cachePath}`);
|
|
|
|
|
+ scheduleMetadataExtractionFromCache(song, cachePath, metadataOptions);
|
|
|
|
|
+ return cachePath;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const fullUrlFromAccount = WebDavUrlUtil.buildFullUrl(account, relativePath);
|
|
|
|
|
+ if (fullUrlFromAccount) {
|
|
|
|
|
+ const sanitizedUrl = sanitizePlaybackUrl(fullUrlFromAccount);
|
|
|
|
|
+ const downloadPromise = triggerWebDavCacheDownload(account, relativePath, sanitizedUrl);
|
|
|
|
|
+ if (downloadPromise) {
|
|
|
|
|
+ downloadPromise.then((completedPath?: string | null) => {
|
|
|
|
|
+ if (completedPath) {
|
|
|
|
|
+ scheduleMetadataExtractionFromCache(song, completedPath, metadataOptions);
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch((error: Error) => {
|
|
|
|
|
+ Logger.error(TAG, `WebDAV 缓存后台下载失败: ${error.message}`);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ Logger.info(TAG, `WebDAV 启动异步缓存: ${relativePath}`);
|
|
|
|
|
+ return sanitizedUrl;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ const fallbackUrl = await WebDavUrlUtil.buildFullUrlByAccountId(song.webdav_account_id, relativePath);
|
|
|
|
|
+ if (fallbackUrl) {
|
|
|
|
|
+ Logger.warn(TAG, `WebDAV 使用全局查询到的URL: ${fallbackUrl}`);
|
|
|
|
|
+ return sanitizePlaybackUrl(fallbackUrl);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Logger.error(TAG, `WebDAV URL构建失败,使用原始路径: ${relativePath}`);
|
|
Logger.error(TAG, `WebDAV URL构建失败,使用原始路径: ${relativePath}`);
|
|
|
return sanitizePlaybackUrl(relativePath);
|
|
return sanitizePlaybackUrl(relativePath);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -307,6 +450,7 @@ async function setVideoUrlForSong(song: VideoItem): Promise<string> {
|
|
|
const relativePath = extractSmbRelativePath(song, account.smbShare);
|
|
const relativePath = extractSmbRelativePath(song, account.smbShare);
|
|
|
const cachedPath = await ensureSmbFileCached(account, relativePath);
|
|
const cachedPath = await ensureSmbFileCached(account, relativePath);
|
|
|
Logger.info(TAG, `SMB 缓存路径: ${cachedPath}`);
|
|
Logger.info(TAG, `SMB 缓存路径: ${cachedPath}`);
|
|
|
|
|
+ scheduleMetadataExtractionFromCache(song, cachedPath, metadataOptions);
|
|
|
return cachedPath;
|
|
return cachedPath;
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
const err = error as Error;
|
|
const err = error as Error;
|
|
@@ -329,7 +473,6 @@ async function setVideoUrlForSong(song: VideoItem): Promise<string> {
|
|
|
return song.filePath;
|
|
return song.filePath;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const workerInstance = new worker.ThreadWorker("entry/ets/workers/Worker.ets");
|
|
|
|
|
// 定义接口
|
|
// 定义接口
|
|
|
interface HiCarAspectRatio {
|
|
interface HiCarAspectRatio {
|
|
|
ratio: number;
|
|
ratio: number;
|
|
@@ -1220,31 +1363,111 @@ export struct LocalMusic {
|
|
|
.slice(0, 60);
|
|
.slice(0, 60);
|
|
|
PreferencesUtil.putSync('albumMap', JSON.stringify(mapArrayAlbum));
|
|
PreferencesUtil.putSync('albumMap', JSON.stringify(mapArrayAlbum));
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case 105: // 缓存完成后返回的元数据
|
|
|
|
|
+ this.handleWorkerMetadataPayload(e.data.data as WorkerMetadataPayload);
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 在调用terminate后,执行onexit
|
|
// 在调用terminate后,执行onexit
|
|
|
workerInstance.onexit = (code) => {
|
|
workerInstance.onexit = (code) => {
|
|
|
- console.log("main thread terminate");
|
|
|
|
|
|
|
+ metadataExtractionInFlight.clear();
|
|
|
|
|
+ Logger.info(TAG, 'workerInstance 线程已退出,code: ' + code);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //若Worker处于已销毁或正在销毁等非运行状态时,调用其功能接口,会抛出相应的错误。
|
|
|
|
|
- // 使用Worker模块时,需要在主线程中注册onerror接口,否则当worker线程出现异常时会发生jscrash问题。
|
|
|
|
|
workerInstance.onerror = (err: ErrorEvent) => {
|
|
workerInstance.onerror = (err: ErrorEvent) => {
|
|
|
-
|
|
|
|
|
- console.log("onerror" + err.message);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ metadataExtractionInFlight.clear();
|
|
|
|
|
+ console.error('workerInstance 线程执行发生异常: ' + err.message)
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext;
|
|
|
|
|
- //碰一碰分享的监听
|
|
|
|
|
- this.knockController = KnockController.getInstance(this.context);
|
|
|
|
|
- this.knockController?.immersiveListening();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ private handleWorkerMetadataPayload(payload: WorkerMetadataPayload | undefined): void {
|
|
|
|
|
+ if (!payload || !payload.originFilePath) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ metadataExtractionInFlight.delete(payload.originFilePath);
|
|
|
|
|
+ if (payload.error) {
|
|
|
|
|
+ Logger.warn(TAG, `缓存文件元数据解析失败: ${payload.error}`);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.applyMetadataToCollections(payload.originFilePath, payload);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private applyMetadataToCollections(filePath: string, payload: WorkerMetadataPayload): void {
|
|
|
|
|
+ const targets: Array<VideoItem> = [];
|
|
|
|
|
+ if (this.currentSong && this.currentSong.filePath === filePath) {
|
|
|
|
|
+ targets.push(this.currentSong);
|
|
|
|
|
+ }
|
|
|
|
|
+ const collectFromList = (list?: Array<VideoItem>) => {
|
|
|
|
|
+ if (!list || list.length === 0) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const found = Utility.getItemByFilePath(list, filePath);
|
|
|
|
|
+ if (found) {
|
|
|
|
|
+ targets.push(found);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ collectFromList(this.songList);
|
|
|
|
|
+ collectFromList(this.videoLocalList);
|
|
|
|
|
+ collectFromList(this.historyList);
|
|
|
|
|
+ collectFromList(this.favList);
|
|
|
|
|
+
|
|
|
|
|
+ const updated = new Set<VideoItem>();
|
|
|
|
|
+ for (let i = 0; i < targets.length; i++) {
|
|
|
|
|
+ const target = targets[i];
|
|
|
|
|
+ if (!target || updated.has(target)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ updated.add(target);
|
|
|
|
|
+ if (payload.name) {
|
|
|
|
|
+ target.name = payload.name;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.artist) {
|
|
|
|
|
+ target.artist = payload.artist;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.album) {
|
|
|
|
|
+ target.album = payload.album;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.bit_rate) {
|
|
|
|
|
+ target.bit_rate = payload.bit_rate;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.duration) {
|
|
|
|
|
+ target.duration = payload.duration;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.sampleRate) {
|
|
|
|
|
+ target.sampleRate = payload.sampleRate;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.mimeType) {
|
|
|
|
|
+ target.mimeType = payload.mimeType;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.md5Str) {
|
|
|
|
|
+ target.md5Str = payload.md5Str;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.videoSize !== undefined) {
|
|
|
|
|
+ target.videoSize = payload.videoSize;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.size) {
|
|
|
|
|
+ target.size = payload.size;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.pixelMapPath) {
|
|
|
|
|
+ target.pixelMapPath = payload.pixelMapPath;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if (this.currentSong && this.currentSong.filePath === filePath) {
|
|
|
|
|
+ if (payload.name) {
|
|
|
|
|
+ this.name = payload.name;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.artist) {
|
|
|
|
|
+ this.artist = payload.artist;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payload.pixelMapPath) {
|
|
|
|
|
+ this.cover = payload.pixelMapPath;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.currentSong = cloneVideoItem(this.currentSong);
|
|
|
|
|
+ AppStorage.setOrCreate('currentSong', this.currentSong);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
onPageHide(): void {
|
|
onPageHide(): void {
|
|
|
this.knockController?.immersiveDisableListening();
|
|
this.knockController?.immersiveDisableListening();
|
|
@@ -1299,7 +1522,10 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[0]
|
|
this.currentSong = this.songList[0]
|
|
|
}
|
|
}
|
|
|
// 使用辅助方法设置videoUrl,等待WebDAV URL构建完成
|
|
// 使用辅助方法设置videoUrl,等待WebDAV URL构建完成
|
|
|
- this.videoUrl = await setVideoUrlForSong(this.currentSong);
|
|
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
Logger.info(TAG, `WebDAV URL同步构建完成: ${this.videoUrl}`);
|
|
Logger.info(TAG, `WebDAV URL同步构建完成: ${this.videoUrl}`);
|
|
|
this.name = this.currentSong.name
|
|
this.name = this.currentSong.name
|
|
|
this.cover = this.currentSong.pixelMapPath
|
|
this.cover = this.currentSong.pixelMapPath
|
|
@@ -6159,7 +6385,10 @@ export struct LocalMusic {
|
|
|
AppStorage.setOrCreate('currentSong', this.currentSong);
|
|
AppStorage.setOrCreate('currentSong', this.currentSong);
|
|
|
|
|
|
|
|
// 使用辅助方法设置videoUrl,等待WebDAV URL构建完成
|
|
// 使用辅助方法设置videoUrl,等待WebDAV URL构建完成
|
|
|
- this.videoUrl = await setVideoUrlForSong(this.currentSong);
|
|
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
Logger.info(TAG, `WebDAV URL同步构建完成(分支2): ${this.videoUrl}`);
|
|
Logger.info(TAG, `WebDAV URL同步构建完成(分支2): ${this.videoUrl}`);
|
|
|
|
|
|
|
|
this.name = this.currentSong.name
|
|
this.name = this.currentSong.name
|
|
@@ -6211,7 +6440,7 @@ export struct LocalMusic {
|
|
|
onCancel:()=>{
|
|
onCancel:()=>{
|
|
|
this.getUIContext().getPromptAction().closeCustomDialog(this.cueComponentId)
|
|
this.getUIContext().getPromptAction().closeCustomDialog(this.cueComponentId)
|
|
|
},
|
|
},
|
|
|
- onDoItemClick:(item: CueTrack, index: number)=>{
|
|
|
|
|
|
|
+ onDoItemClick: async (item: CueTrack, index: number)=>{
|
|
|
//获取cueinfo对应的filePath
|
|
//获取cueinfo对应的filePath
|
|
|
let globalVideoList = Utility.getGlobalList(this.videoLocalList, CommonConstants.TYPE_LOCAL) as VideoItem[];
|
|
let globalVideoList = Utility.getGlobalList(this.videoLocalList, CommonConstants.TYPE_LOCAL) as VideoItem[];
|
|
|
this.curIndex = Utility.getCurIndexFromGlobalList(globalVideoList, cueinfo.filePath)
|
|
this.curIndex = Utility.getCurIndexFromGlobalList(globalVideoList, cueinfo.filePath)
|
|
@@ -6224,10 +6453,16 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
this.songList = globalVideoList
|
|
this.songList = globalVideoList
|
|
|
this.sonDataSource.pushArrayData(this.songList)
|
|
this.sonDataSource.pushArrayData(this.songList)
|
|
|
- if(this.currentSong && isRemoteCloudType(this.currentSong.type!)){
|
|
|
|
|
- this.videoUrl = sanitizePlaybackUrl(this.currentSong.filePath);
|
|
|
|
|
- }else{
|
|
|
|
|
- this.videoUrl = this.currentSong.filePath
|
|
|
|
|
|
|
+ if (this.currentSong) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ Logger.error(TAG, `CUE 点播构建播放地址失败: ${(error as Error).message}`);
|
|
|
|
|
+ this.videoUrl = this.currentSong.filePath;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
this.name = item.title||this.currentSong.name
|
|
this.name = item.title||this.currentSong.name
|
|
|
this.cover = this.currentSong.pixelMapPath
|
|
this.cover = this.currentSong.pixelMapPath
|
|
@@ -13425,7 +13660,10 @@ export struct LocalMusic {
|
|
|
Logger.info('heanup playNext', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
Logger.info('heanup playNext', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
|
|
|
|
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
|
- this.videoUrl = await setVideoUrlForSong(this.currentSong);
|
|
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
this.name = this.songList[this.curIndex].name
|
|
this.name = this.songList[this.curIndex].name
|
|
@@ -13516,7 +13754,10 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[this.curIndex];
|
|
this.currentSong = this.songList[this.curIndex];
|
|
|
|
|
|
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
|
- this.videoUrl = await setVideoUrlForSong(this.currentSong);
|
|
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
this.name = this.songList[this.curIndex].name;
|
|
this.name = this.songList[this.curIndex].name;
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
// this.cover = this.songList[this.curIndex].pixelMapPath
|
|
// this.cover = this.songList[this.curIndex].pixelMapPath
|
|
@@ -13536,7 +13777,10 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[index];
|
|
this.currentSong = this.songList[index];
|
|
|
|
|
|
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
|
- this.videoUrl = await setVideoUrlForSong(this.currentSong);
|
|
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
this.name = this.currentSong.name
|
|
this.name = this.currentSong.name
|
|
|
this.artist = this.currentSong.artist
|
|
this.artist = this.currentSong.artist
|
|
@@ -13569,7 +13813,10 @@ export struct LocalMusic {
|
|
|
Logger.info('heanup playPrevious', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
Logger.info('heanup playPrevious', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
|
|
|
|
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
|
- this.videoUrl = await setVideoUrlForSong(this.currentSong);
|
|
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
this.name = this.songList[this.curIndex].name
|
|
this.name = this.songList[this.curIndex].name
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
this.changeImageAnimation()
|
|
this.changeImageAnimation()
|
|
@@ -13589,7 +13836,10 @@ export struct LocalMusic {
|
|
|
Logger.info('heanup randomModePlayFromHistory', `直接使用历史歌曲信息: ${prevSong.name}, type: ${prevSong.type}`);
|
|
Logger.info('heanup randomModePlayFromHistory', `直接使用历史歌曲信息: ${prevSong.name}, type: ${prevSong.type}`);
|
|
|
|
|
|
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
|
- this.videoUrl = await setVideoUrlForSong(this.currentSong);
|
|
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
this.cover = prevSong.pixelMapPath
|
|
this.cover = prevSong.pixelMapPath
|
|
|
this.artist = prevSong.artist
|
|
this.artist = prevSong.artist
|
|
|
this.name = prevSong.name;
|
|
this.name = prevSong.name;
|
|
@@ -13610,7 +13860,10 @@ export struct LocalMusic {
|
|
|
Logger.info('heanup randomModePlayFromHistory', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
Logger.info('heanup randomModePlayFromHistory', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
|
|
|
|
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
// 设置videoUrl,WebDAV歌曲会通过webdav_account_id构建完整URL
|
|
|
- this.videoUrl = await setVideoUrlForSong(this.currentSong);
|
|
|
|
|
|
|
+ this.videoUrl = await setVideoUrlForSong(this.currentSong, {
|
|
|
|
|
+ context: this.context,
|
|
|
|
|
+ autoParseMusicName: this.autoParseMusicName
|
|
|
|
|
+ });
|
|
|
this.artist = this.songList[this.curIndex].artist
|
|
this.artist = this.songList[this.curIndex].artist
|
|
|
this.name = this.songList[this.curIndex].name;
|
|
this.name = this.songList[this.curIndex].name;
|
|
|
this.changeImageAnimation()
|
|
this.changeImageAnimation()
|