tmdb匹配前先替换下划线为空格,提升匹配概率

This commit is contained in:
mtvpls
2025-12-26 02:13:53 +08:00
parent d66538e992
commit 0b37e663fe
4 changed files with 16 additions and 7 deletions

View File

@@ -249,7 +249,6 @@ async function performScan(
// 如果是第二季及以后替换标题和ID
if (seasonDetails.season.season_number > 1) {
folderInfo.title = `${folderInfo.title} ${seasonDetails.season.name}`;
folderInfo.tmdb_id = seasonDetails.season.id; // 使用季度的ID
}
// 使用季度的海报(如果有)

View File

@@ -2077,7 +2077,7 @@ function PlayPageClient() {
}
}
let newDetail = availableSources.find(
let newDetail: SearchResult | undefined = availableSources.find(
(source) => source.source === newSource && source.id === newId
);
if (!newDetail) {
@@ -2090,7 +2090,11 @@ function PlayPageClient() {
try {
const detailResponse = await fetch(`/api/detail?source=${newSource}&id=${newId}`);
if (detailResponse.ok) {
newDetail = await detailResponse.json();
const detailData = await detailResponse.json();
if (!detailData) {
throw new Error('获取的详情数据为空');
}
newDetail = detailData;
} else {
throw new Error('获取 openlist 详情失败');
}
@@ -2102,6 +2106,12 @@ function PlayPageClient() {
}
}
// 再次确认 newDetail 不为空(类型守卫)
if (!newDetail) {
setError('视频详情数据无效');
return;
}
// 尝试跳转到当前正在播放的集数
let targetIndex = currentEpisodeIndex;