|
@@ -153,17 +153,20 @@ function getTypeOrder(type: number) {
|
|
|
async function setVideoUrlForSong(song: VideoItem): Promise<string> {
|
|
async function setVideoUrlForSong(song: VideoItem): Promise<string> {
|
|
|
if (song.type === CommonConstants.TYPE_WEBDAV && song.webdav_account_id) {
|
|
if (song.type === CommonConstants.TYPE_WEBDAV && song.webdav_account_id) {
|
|
|
try {
|
|
try {
|
|
|
- const fullUrl = await WebDavUrlUtil.buildFullUrlByAccountId(song.webdav_account_id, song.filePath);
|
|
|
|
|
|
|
+ // 优先使用远端相对路径,其次回退到 filePath
|
|
|
|
|
+ const relativePath = song.remote_rel_path || song.filePath;
|
|
|
|
|
+ const fullUrl = await WebDavUrlUtil.buildFullUrlByAccountId(song.webdav_account_id, relativePath);
|
|
|
if (fullUrl) {
|
|
if (fullUrl) {
|
|
|
Logger.info(TAG, `WebDAV完整URL构建成功: ${fullUrl}`);
|
|
Logger.info(TAG, `WebDAV完整URL构建成功: ${fullUrl}`);
|
|
|
return fullUrl.replace(/ /g, '%20');
|
|
return fullUrl.replace(/ /g, '%20');
|
|
|
} else {
|
|
} else {
|
|
|
- Logger.error(TAG, `WebDAV URL构建失败,使用原始路径: ${song.filePath}`);
|
|
|
|
|
- return song.filePath.replace(/ /g, '%20');
|
|
|
|
|
|
|
+ Logger.error(TAG, `WebDAV URL构建失败,使用原始路径: ${relativePath}`);
|
|
|
|
|
+ return relativePath.replace(/ /g, '%20');
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
Logger.error(TAG, `WebDAV URL构建出错: ${(error as Error).message}`);
|
|
Logger.error(TAG, `WebDAV URL构建出错: ${(error as Error).message}`);
|
|
|
- return song.filePath.replace(/ /g, '%20');
|
|
|
|
|
|
|
+ const fallbackPath = song.remote_rel_path || song.filePath;
|
|
|
|
|
+ return fallbackPath.replace(/ /g, '%20');
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
// 非WebDAV文件或缺少webdav_account_id,直接使用原始路径
|
|
// 非WebDAV文件或缺少webdav_account_id,直接使用原始路径
|