mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 03:27:39 +08:00
feat: better episode matching
This commit is contained in:
@@ -109,6 +109,21 @@ func parseEnglishName(name string) *Metadata {
|
|||||||
}
|
}
|
||||||
meta.Episode = n
|
meta.Episode = n
|
||||||
}
|
}
|
||||||
|
} else { //no episode, maybe like One Punch Man S2 - 08 [1080p].mkv
|
||||||
|
|
||||||
|
numRe := regexp.MustCompile(`^\d{1,2}$`)
|
||||||
|
for _, p := range newSplits {
|
||||||
|
if numRe.MatchString(p) {
|
||||||
|
//episodeIndex = i
|
||||||
|
n, err := strconv.Atoi(p)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("convert %s error: %v", p, err))
|
||||||
|
}
|
||||||
|
meta.Episode = n
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if resIndex != -1 {
|
if resIndex != -1 {
|
||||||
//resolution exists
|
//resolution exists
|
||||||
@@ -118,7 +133,7 @@ func parseEnglishName(name string) *Metadata {
|
|||||||
meta.IsSeasonPack = true
|
meta.IsSeasonPack = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if seasonIndex != 0 {
|
if seasonIndex > 0 {
|
||||||
//name exists
|
//name exists
|
||||||
names := newSplits[0:seasonIndex]
|
names := newSplits[0:seasonIndex]
|
||||||
meta.NameEn = strings.TrimSpace(strings.Join(names, " "))
|
meta.NameEn = strings.TrimSpace(strings.Join(names, " "))
|
||||||
|
|||||||
Reference in New Issue
Block a user