fix review regressions in titles and strm paths

This commit is contained in:
ShukeBta
2026-06-27 16:07:30 +08:00
parent e22b537de4
commit 41f39d9701
4 changed files with 16 additions and 31 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ function stripLibraryCategoryAfterSTRMRoot(raw: string) {
if (strmIndex < 0 || strmIndex >= parts.length - 1) return ''
const tail = parts.slice(strmIndex + 1).filter((part) => part.trim())
const categoryParts = categoryPartsFromPath(tail)
if (!categoryParts?.length) return ''
if (!categoryParts || categoryParts.length < 2) return ''
return trimPath(parts.slice(0, strmIndex + 1).join('/'))
}
+4 -1
View File
@@ -197,9 +197,12 @@ const EPISODE_ONLY_TITLE_RE =
const EPISODE_TITLE_RE =
/^第\s*[0-9一二三四五六七八九十百零两]+\s*[集期话話](?:\s*[上下])?\s*[::].+/
const EPISODIC_RELEASE_TITLE_RE =
/(?:^|\s)(?:s\d{1,2}\s*e\d{1,3}|season\s*\d{1,2}\s*(?:episode|ep)\s*\d{1,3}|\d{1,2}x\d{1,3}|e(?:p(?:isode)?)?\s*\d{1,3})(?:\s|$)/i
function unsafeEpisodeTitle(title: string): boolean {
const value = title.trim()
return EPISODE_ONLY_TITLE_RE.test(value) || EPISODE_TITLE_RE.test(value)
return EPISODE_ONLY_TITLE_RE.test(value) || EPISODE_TITLE_RE.test(value) || EPISODIC_RELEASE_TITLE_RE.test(normalizeTitle(value))
}
export function seriesTitleFromPath(path?: string): string {