Skip to content

Commit

Permalink
电视剧匹配调整
Browse files Browse the repository at this point in the history
  • Loading branch information
fengqi committed Apr 5, 2023
1 parent 73ed296 commit ff61b8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions shows/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,26 @@ func parseShowsFile(dir *Dir, file fs.FileInfo) *File {
// 判断是视频, 并获取后缀
suffix := utils.IsVideo(fileName)
if len(suffix) == 0 {
utils.Logger.DebugF("pass : %s", fileName)
utils.Logger.DebugF("pass : %s", file.Name())
return nil
}

fileName = utils.ReplaceChsNumber(fileName)

// 提取季和集
se, snum, enum := utils.MatchEpisode(fileName)
if dir.Season > 0 {
snum = dir.Season
}
utils.Logger.InfoF("find season: %d episode: %d %s", snum, enum, fileName)
utils.Logger.InfoF("find season: %d episode: %d %s", snum, enum, file.Name())
if len(se) == 0 || snum == 0 || enum == 0 {
utils.Logger.WarningF("seaon or episode not find: %s", fileName)
utils.Logger.WarningF("seaon or episode not find: %s", file.Name())
return nil
}

return &File{
Dir: dir.Dir + "/" + dir.OriginTitle,
OriginTitle: fileName,
OriginTitle: file.Name(),
Season: snum,
Episode: enum,
SeasonEpisode: se,
Expand All @@ -69,7 +71,7 @@ func parseShowsDir(baseDir string, file fs.FileInfo) *Dir {
showName = utils.FilterOptionals(showName)

// 过滤掉或替换歧义的内容
showName = utils.FilterCorrecting(showName)
showName = utils.SeasonCorrecting(showName)

// 过滤掉分段的干扰
if subEpisodes := utils.IsSubEpisodes(showName); subEpisodes != "" {
Expand Down
2 changes: 1 addition & 1 deletion utils/video_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func TestMatchEpisode(t *testing.T) {
"Kimetsu.no.Yaiba.Yuukaku-hen.E01.2021.Crunchyroll.WEB-DL.1080p.x264.AAC-HDCTV.mkv": {1, 1},
"Overlord IV - 09.mp4": {1, 9},
"宝贝揪揪 第3季 第10集.mp4": {3, 10},
"宝贝揪揪 3季 10集.mp4": {3, 10},
"宝贝揪揪 第9集.mp4": {1, 9},
"Gannibal.E01.2022": {1, 1},
"Gannibal E01 2022": {1, 1},
"Gannibal S01 E01 2022": {1, 1},
}
for name, cse := range cases {
Expand Down

0 comments on commit ff61b8e

Please sign in to comment.