Save when its complete
This commit is contained in:
@@ -220,17 +220,24 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if filter.HasEpisodes {
|
if filter.HasEpisodes {
|
||||||
regex := regexp.MustCompile(`(?i)s\d{2,3}.?e\d{2,3}`)
|
regexes := []*regexp.Regexp{
|
||||||
if regex.MatchString(torrentName) {
|
regexp.MustCompile(`(?i)s\d\d\d?.?e\d\d\d?`),
|
||||||
return true
|
regexp.MustCompile(`(?i)seasons?\s?\d+`),
|
||||||
|
regexp.MustCompile(`(?i)episodes?\s?\d+`),
|
||||||
|
regexp.MustCompile(`(?i)[a-fA-F0-9]{8}`),
|
||||||
}
|
}
|
||||||
for _, filename := range fileNames {
|
for _, regex := range regexes {
|
||||||
if regex.MatchString(filename) {
|
if regex.MatchString(torrentName) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
for _, filename := range fileNames {
|
||||||
|
if regex.MatchString(filename) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//remove resolution from filenames
|
//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 {
|
for i, filename := range fileNames {
|
||||||
fileNames[i] = regex.ReplaceAllString(filename, "")
|
fileNames[i] = regex.ReplaceAllString(filename, "")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,16 +220,13 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
|||||||
}
|
}
|
||||||
torrent.DownloadedIDs = mapset.NewSet[string]()
|
torrent.DownloadedIDs = mapset.NewSet[string]()
|
||||||
torrent.InProgressIDs = mapset.NewSet[string]()
|
torrent.InProgressIDs = mapset.NewSet[string]()
|
||||||
if info.Progress == 100 {
|
if rdTorrent.Progress == 100 {
|
||||||
torrent.DownloadedIDs.Add(info.ID)
|
torrent.DownloadedIDs.Add(info.ID)
|
||||||
} else {
|
// save to cache if it's not in progress anymore
|
||||||
torrent.InProgressIDs.Add(info.ID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// save to cache if it's not in progress anymore
|
|
||||||
if info.Progress == 100 {
|
|
||||||
infoCache.Set(rdTorrent.ID, &torrent)
|
infoCache.Set(rdTorrent.ID, &torrent)
|
||||||
t.saveTorrentChangesToDisk(&torrent, nil)
|
t.saveTorrentChangesToDisk(&torrent, nil)
|
||||||
|
} else {
|
||||||
|
torrent.InProgressIDs.Add(info.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &torrent
|
return &torrent
|
||||||
|
|||||||
Reference in New Issue
Block a user