Skip to content

Commit

Permalink
fix(processor): don't match sample in torrents
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxencs committed Nov 8, 2024
1 parent 65be43b commit cf5704a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/http/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (p *processor) processSeasonPack() (domain.StatusCode, error) {
var fileName string
var size int64
for _, f := range *torrentFiles {
if filepath.Ext(f.Name) != ".mkv" {
if !release.IsValidEpisodeFile(f.Name) {
continue
}

Expand Down
16 changes: 16 additions & 0 deletions internal/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,19 @@ func PercentOfTotalEpisodes(totalEps int, foundEps int) float32 {

return float32(foundEps) / float32(totalEps)
}

func IsValidEpisodeFile(torrentFileName string) bool {
torrentFileRls := rls.ParseString(filepath.Base(torrentFileName))

// ignore non video files
if torrentFileRls.Ext != "mkv" {
return false
}

// ignore sample files
if rls.MustNormalize(torrentFileRls.Group) == "sample" {
return false
}

return true
}

0 comments on commit cf5704a

Please sign in to comment.