Return an error for 503
This commit is contained in:
@@ -138,7 +138,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
|
||||
}
|
||||
|
||||
// proxy function
|
||||
func (t *TorrentManager) UnrestrictLinkUntilOk(link string, checkFirstByte bool) *realdebrid.Download {
|
||||
func (t *TorrentManager) UnrestrictLink(link string, verifyURL bool) *realdebrid.Download {
|
||||
isRealDebrid := strings.HasPrefix(link, "https://real-debrid.com/d/")
|
||||
if isRealDebrid && t.UnrestrictMap.Has(link[0:39]) {
|
||||
ret, _ := t.UnrestrictMap.Get(link[0:39])
|
||||
@@ -147,7 +147,7 @@ func (t *TorrentManager) UnrestrictLinkUntilOk(link string, checkFirstByte bool)
|
||||
ret, _ := t.UnrestrictMap.Get(link)
|
||||
return ret
|
||||
}
|
||||
ret, err := t.api.UnrestrictLink(link, checkFirstByte)
|
||||
ret, err := t.api.UnrestrictLink(link, verifyURL)
|
||||
if err != nil {
|
||||
t.log.Warnf("Cannot unrestrict link %s: %v", link, err)
|
||||
return nil
|
||||
@@ -160,11 +160,11 @@ func (t *TorrentManager) UnrestrictLinkUntilOk(link string, checkFirstByte bool)
|
||||
return ret
|
||||
}
|
||||
|
||||
func (t *TorrentManager) UnrestrictFileUntilOk(file *File, checkFirstByte bool) *realdebrid.Download {
|
||||
func (t *TorrentManager) UnrestrictFile(file *File, checkFirstByte bool) *realdebrid.Download {
|
||||
if !file.State.Is("ok_file") {
|
||||
return nil
|
||||
}
|
||||
return t.UnrestrictLinkUntilOk(file.Link, checkFirstByte)
|
||||
return t.UnrestrictLink(file.Link, checkFirstByte)
|
||||
}
|
||||
|
||||
func (t *TorrentManager) GetKey(torrent *Torrent) string {
|
||||
@@ -235,7 +235,7 @@ func (t *TorrentManager) applyMediaInfoDetails(torrent *Torrent) {
|
||||
if file.MediaInfo != nil || !file.State.Is("ok_file") || !isPlayable {
|
||||
return
|
||||
}
|
||||
unrestrict := t.UnrestrictFileUntilOk(file, true)
|
||||
unrestrict := t.UnrestrictFile(file, true)
|
||||
if unrestrict == nil {
|
||||
file.State.Event(context.Background(), "break_file")
|
||||
t.EnqueueForRepair(torrent)
|
||||
|
||||
Reference in New Issue
Block a user