Skip to content

Commit

Permalink
剧集增加特殊处理逻辑,修正部分剧集扫描
Browse files Browse the repository at this point in the history
  • Loading branch information
fengqi committed Apr 5, 2024
1 parent 9228201 commit 010bf54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions shows/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,13 @@ func (c *Collector) scanShowsFile(d *Dir) (map[string]*File, error) {
for i, item := range movieFiles {
item.Episode = i + 1
item.SeasonEpisode = fmt.Sprintf("s%02de%02d", item.Season, item.Episode)
utils.Logger.DebugF("scanShowsFile partMode=%d, correct episode to %d", d.PartMode, item.Episode, item.OriginTitle)
utils.Logger.DebugF("scanShowsFile partMode=%d, correct episode to %d", d.PartMode, item.Episode)
}
} else if d.PartMode > 1 {
for _, item := range movieFiles {
item.Episode = (item.Episode-1)*d.PartMode + item.Part
item.SeasonEpisode = fmt.Sprintf("s%02de%02d", item.Season, item.Episode)
utils.Logger.DebugF("scanShowsFile partMode=%d, correct episode to %d", d.PartMode, item.Episode, item.OriginTitle)
utils.Logger.DebugF("scanShowsFile partMode=%d, correct episode to %d", d.PartMode, item.Episode)
}
}

Expand All @@ -387,10 +387,13 @@ func (c *Collector) parseShowsFile(dir *Dir, file fs.FileInfo) *File {
return nil
}

fileName = strings.Replace(fileName, "."+suffix, "", 1)
fileName = utils.FilterOptionals(fileName)
fileName = utils.ReplaceChsNumber(fileName)
fileName = utils.EpisodeCorrecting(fileName)

// 提取季和集
snum, enum := utils.MatchEpisode(fileName)
snum, enum := utils.MatchEpisode(fileName + "." + suffix)
if dir.Season > 0 {
snum = dir.Season
}
Expand Down
1 change: 1 addition & 0 deletions utils/video_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestMatchEpisode(t *testing.T) {
"Gannibal.Season01.EP02.2022.mp4": {1, 2},
"转生成自动贩卖机02全片简中.mp4": {1, 2},
"地球脉动.第3季.Planet.Earth.S03E02.2023.2160p.WEB-DL.H265.10bit.DDP2.0.2Audio-OurTV.mp4": {3, 2},
"E01.mkv": {1, 1},
}
for name, cse := range cases {
s, e := MatchEpisode(name)
Expand Down

0 comments on commit 010bf54

Please sign in to comment.