mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-29 19:36:36 +08:00
fix: improve discover and manual scrape controls
This commit is contained in:
@@ -113,15 +113,26 @@ function normalizeTitle(value?: string): string {
|
||||
.trim()
|
||||
}
|
||||
|
||||
const SERIES_SPECIAL_SUFFIX_RE =
|
||||
/(?:\s+(?:s0+|season 0+|special episodes?|specials?|sp|ovas?|oads?|extras?|bonus(?:es)?|omake)|\s*(?:特别篇|特別篇|番外篇?|特典|外传|外傳|总集篇|總集篇))$/i
|
||||
const SERIES_SPECIAL_CODE_RE =
|
||||
/\s*[\[((【]?\s*(?:s0+\s*e?\s*\d+|season\s*0+(?:\s*episode)?\s*\d*|special(?:\s*episode)?s?\s*\d*|sp\s*\d*|ovas?\s*\d*|oads?\s*\d*|extras?\s*\d*|bonus(?:es)?\s*\d*|omake\s*\d*)\s*[\]))】]?$/i
|
||||
|
||||
const SERIES_SPECIAL_CJK_RE =
|
||||
/\s*[\[((【]?\s*(?:特别篇|特別篇|番外篇?|特典|外传|外傳|总集篇|總集篇)(?:\s*第?\s*[0-9一二三四五六七八九十百零两]+(?:[集话話期])?)?\s*[\]))】]?$/i
|
||||
|
||||
function normalizePathSeriesTitle(value?: string): string {
|
||||
const title = normalizeTitle(value)
|
||||
const stripped = title.replace(SERIES_SPECIAL_SUFFIX_RE, '').trim()
|
||||
const stripped = stripSeriesSpecialSuffix(title)
|
||||
return stripped || title
|
||||
}
|
||||
|
||||
function stripSeriesSpecialSuffix(title: string): string {
|
||||
for (const pattern of [SERIES_SPECIAL_CODE_RE, SERIES_SPECIAL_CJK_RE]) {
|
||||
const stripped = title.replace(pattern, '').trim()
|
||||
if (stripped && stripped !== title) return stripped
|
||||
}
|
||||
return title
|
||||
}
|
||||
|
||||
export function seriesTitleFromPath(path?: string): string {
|
||||
if (!path) return ''
|
||||
const parts = path.split(/[\\/]+/).filter(Boolean)
|
||||
|
||||
Reference in New Issue
Block a user