refactor(音乐同步): 优化歌曲匹配逻辑,优先使用提供的songId
当songId存在时,跳过冗余的网易云匹配流程,直接使用songId进行精确匹配 如果精确匹配失败,再回退到基于名称的匹配方式
This commit is contained in:
@@ -93,21 +93,15 @@ async function createJob(req, res) {
|
||||
}
|
||||
|
||||
if (songId) {
|
||||
const songFromWyCloud = await findTheBestMatchFromWyCloud(req.account.uid, {
|
||||
songName: meta.songName,
|
||||
artist: meta.artist,
|
||||
album: meta.album,
|
||||
musicPlatformSongId: songId,
|
||||
});
|
||||
if (!songFromWyCloud) {
|
||||
logger.error(`song not found in wycloud`);
|
||||
res.status(412).send({
|
||||
status: 1,
|
||||
message: "can not find song in wycloud with your songId",
|
||||
});
|
||||
return;
|
||||
}
|
||||
meta.songFromWyCloud = songFromWyCloud;
|
||||
// 直接传递songId给后续处理,避免冗余的网易云匹配
|
||||
// 如果后续需要,可以根据songId进行精确匹配
|
||||
meta.songFromWyCloud = {
|
||||
songId: songId,
|
||||
songName: meta.songName || "",
|
||||
artist: meta.artist || "",
|
||||
album: meta.album || "",
|
||||
};
|
||||
logger.info(`[sync_jobs] Using provided songId: ${songId}, will handle matching later if needed`);
|
||||
}
|
||||
|
||||
// create job
|
||||
|
||||
Reference in New Issue
Block a user