优化自动匹配和记住集episode偏移功能
This commit is contained in:
1 parent
028835c2c4
commit
871db792da
2 files changed
+7
-7
No files matched your search
@@ -577,7 +577,7 @@ function extractPlatformFromTitle(title) {
|
||||
}
|
||||
|
||||
// 根据集数匹配episode(优先使用集标题中的集数,其次使用episodeNumber,最后使用数组索引)
|
||||
function findEpisodeByNumber(filteredEpisodes, targetEpisode, platform = null) {
|
||||
function findEpisodeByNumber(filteredEpisodes, episode, targetEpisode, platform = null) {
|
||||
if (!filteredEpisodes || filteredEpisodes.length === 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -599,7 +599,7 @@ function findEpisodeByNumber(filteredEpisodes, targetEpisode, platform = null) {
|
||||
// 策略1:从集标题中提取集数进行匹配
|
||||
for (const ep of platformEpisodes) {
|
||||
const extractedNumber = extractEpisodeNumberFromTitle(ep.episodeTitle);
|
||||
if (extractedNumber === targetEpisode) {
|
||||
if (episode === targetEpisode && extractedNumber === targetEpisode) {
|
||||
log("info", `Found episode by title number: ${ep.episodeTitle} (extracted: ${extractedNumber})`);
|
||||
return ep;
|
||||
}
|
||||
@@ -711,7 +711,7 @@ async function matchAniAndEpByAi(season, episode, year, searchData, title, req,
|
||||
log("info", "过滤后的集标题", filteredEpisodes.map(episode => episode.episodeTitle));
|
||||
|
||||
// 匹配集数 (注意:findEpisodeByNumber 已增强支持模糊平台匹配)
|
||||
filteredEpisode = findEpisodeByNumber(filteredEpisodes, episode);
|
||||
filteredEpisode = findEpisodeByNumber(filteredEpisodes, episode, episode);
|
||||
} else {
|
||||
// 电影模式逻辑
|
||||
if (bangumiData.bangumi.episodes.length > 0) {
|
||||
@@ -856,7 +856,7 @@ async function matchAniAndEp(season, episode, year, searchData, title, req, plat
|
||||
}
|
||||
|
||||
// 匹配集数 (注意:findEpisodeByNumber 已增强支持模糊平台匹配)
|
||||
matchedEpisode = findEpisodeByNumber(filteredEpisodes, targetEpisode, platform);
|
||||
matchedEpisode = findEpisodeByNumber(filteredEpisodes, episode, targetEpisode, platform);
|
||||
} else {
|
||||
// 电影模式逻辑
|
||||
if (bangumiData.bangumi.episodes.length > 0) {
|
||||
@@ -943,7 +943,7 @@ async function fallbackMatchAniAndEp(searchData, req, season, episode, year, res
|
||||
}
|
||||
|
||||
// 使用新的集数匹配策略
|
||||
const matchedEpisode = findEpisodeByNumber(filteredEpisodes, targetEpisode, null);
|
||||
const matchedEpisode = findEpisodeByNumber(filteredEpisodes, episode, targetEpisode, null);
|
||||
if (matchedEpisode) {
|
||||
resEpisode = matchedEpisode;
|
||||
resAnime = anime;
|
||||
@@ -1640,7 +1640,7 @@ export async function getComment(path, queryFormat, segmentFlag, clientIp, inclu
|
||||
|
||||
if (clientIp) {
|
||||
const lastSearch = getLastSearch(clientIp);
|
||||
if (lastSearch && lastSearch.episodeId === commentId && lastSearch.title && lastSearch.season && lastSearch.episode && episodeTitle) {
|
||||
if (lastSearch && lastSearch.title && lastSearch.season && lastSearch.episode && episodeTitle) {
|
||||
lastTitle = lastSearch.title;
|
||||
lastSeason = lastSearch.season;
|
||||
offset = `${lastSearch.episode}:${episodeTitle}`;
|
||||
|
||||
@@ -13,7 +13,7 @@ export const Globals = {
|
||||
accessedEnvVars: {},
|
||||
|
||||
// 静态常量
|
||||
VERSION: '1.18.8',
|
||||
VERSION: '1.18.9',
|
||||
MAX_LOGS: 1000, // 日志存储,最多保存 1000 行
|
||||
MAX_RECORDS: 100, // 请求记录最大数量
|
||||
|
||||
|
||||
Reference in new issue
Block a user