diff --git a/internal/config/v1.go b/internal/config/v1.go index bdf73e0..5ade635 100644 --- a/internal/config/v1.go +++ b/internal/config/v1.go @@ -220,17 +220,24 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren return false } if filter.HasEpisodes { - regex := regexp.MustCompile(`(?i)s\d{2,3}.?e\d{2,3}`) - if regex.MatchString(torrentName) { - return true + regexes := []*regexp.Regexp{ + regexp.MustCompile(`(?i)s\d\d\d?.?e\d\d\d?`), + regexp.MustCompile(`(?i)seasons?\s?\d+`), + regexp.MustCompile(`(?i)episodes?\s?\d+`), + regexp.MustCompile(`(?i)[a-fA-F0-9]{8}`), } - for _, filename := range fileNames { - if regex.MatchString(filename) { + for _, regex := range regexes { + if regex.MatchString(torrentName) { return true } + for _, filename := range fileNames { + if regex.MatchString(filename) { + return true + } + } } //remove resolution from filenames - regex = regexp.MustCompile(`(?i)((720|1080|2160|480|360|240|144)[pi]|\d{3,4}x\d{3,4})`) + regex := regexp.MustCompile(`(?i)((720|1080|2160|480|360|240|144)[pi]|\d{3,4}x\d{3,4})`) for i, filename := range fileNames { fileNames[i] = regex.ReplaceAllString(filename, "") } diff --git a/internal/torrent/refresh.go b/internal/torrent/refresh.go index d893326..7dbf584 100644 --- a/internal/torrent/refresh.go +++ b/internal/torrent/refresh.go @@ -220,16 +220,13 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent { } torrent.DownloadedIDs = mapset.NewSet[string]() torrent.InProgressIDs = mapset.NewSet[string]() - if info.Progress == 100 { + if rdTorrent.Progress == 100 { torrent.DownloadedIDs.Add(info.ID) - } else { - torrent.InProgressIDs.Add(info.ID) - } - - // save to cache if it's not in progress anymore - if info.Progress == 100 { + // save to cache if it's not in progress anymore infoCache.Set(rdTorrent.ID, &torrent) t.saveTorrentChangesToDisk(&torrent, nil) + } else { + torrent.InProgressIDs.Add(info.ID) } return &torrent