Do not unrestrict files that are marked as broken until it is fixed

This commit is contained in:
Ben Sarmiento
2024-02-20 11:32:48 +01:00
parent 15332779e3
commit 6d7c639125
3 changed files with 12 additions and 5 deletions

View File

@@ -81,7 +81,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
}
// proxy
func (t *TorrentManager) UnrestrictUntilOk(link string) *realdebrid.Download {
func (t *TorrentManager) UnrestrictLinkUntilOk(link string) *realdebrid.Download {
// check if it's a valid link
if !strings.HasPrefix(link, "http") {
return nil
@@ -103,6 +103,13 @@ func (t *TorrentManager) UnrestrictUntilOk(link string) *realdebrid.Download {
return ret
}
func (t *TorrentManager) UnrestrictFileUntilOk(file *File) *realdebrid.Download {
if file.IsBroken || file.IsDeleted {
return nil
}
return t.UnrestrictLinkUntilOk(file.Link)
}
func (t *TorrentManager) GetKey(torrent *Torrent) string {
if !t.Config.ShouldIgnoreRenames() && torrent.Rename != "" {
return torrent.Rename