feat: 优化音源逻辑

This commit is contained in:
alger
2025-08-12 19:54:20 +08:00
parent ad51f57bd7
commit ad57673129
+4 -2
View File
@@ -146,6 +146,7 @@ const getUnblockMusicAudio = (id: number, data: SongResult, sources: any[]) => {
* @returns 解析结果
*/
export const getParsingMusicUrl = async (id: number, data: SongResult) => {
if(isElectron){
const settingStore = useSettingsStore();
// 如果禁用了音乐解析功能,则直接返回空结果
@@ -167,7 +168,7 @@ export const getParsingMusicUrl = async (id: number, data: SongResult) => {
// 使用全局音源设置
musicSources = settingStore.setData.enabledMusicSources || [];
console.log(`使用全局音源设置:`, musicSources);
if (isElectron && musicSources.length > 0) {
if (musicSources.length > 0) {
return getUnblockMusicAudio(id, data, musicSources);
}
}
@@ -192,9 +193,10 @@ export const getParsingMusicUrl = async (id: number, data: SongResult) => {
}
console.log('musicSources', musicSources);
// 2.3 使用unblockMusic解析其他音源
if (isElectron && musicSources.length > 0) {
if (musicSources.length > 0) {
return getUnblockMusicAudio(id, data, musicSources);
}
}
// 3. 后备方案:使用API请求
console.log('无可用音源或不在Electron环境中,使用API请求');