Save when its complete
This commit is contained in:
@@ -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, "")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user