Verify if downloadable
This commit is contained in:
@@ -93,12 +93,12 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
|
||||
}
|
||||
|
||||
// proxy function
|
||||
func (t *TorrentManager) UnrestrictLinkUntilOk(link string) *realdebrid.Download {
|
||||
func (t *TorrentManager) UnrestrictLinkUntilOk(link string, checkFirstByte bool) *realdebrid.Download {
|
||||
if strings.HasPrefix(link, "https://real-debrid.com/d/") && t.DownloadMap.Has(link[0:39]) {
|
||||
ret, _ := t.DownloadMap.Get(link[0:39])
|
||||
return ret
|
||||
}
|
||||
ret, err := t.api.UnrestrictLink(link, t.Config.ShouldServeFromRclone())
|
||||
ret, err := t.api.UnrestrictLink(link, checkFirstByte)
|
||||
t.DownloadMap.Set(ret.Link[0:39], ret)
|
||||
if err != nil {
|
||||
t.log.Warnf("Cannot unrestrict link %s: %v", link, err)
|
||||
@@ -108,11 +108,11 @@ func (t *TorrentManager) UnrestrictLinkUntilOk(link string) *realdebrid.Download
|
||||
return ret
|
||||
}
|
||||
|
||||
func (t *TorrentManager) UnrestrictFileUntilOk(file *File) *realdebrid.Download {
|
||||
func (t *TorrentManager) UnrestrictFileUntilOk(file *File, checkFirstByte bool) *realdebrid.Download {
|
||||
if !file.State.Is("ok_file") {
|
||||
return nil
|
||||
}
|
||||
return t.UnrestrictLinkUntilOk(file.Link)
|
||||
return t.UnrestrictLinkUntilOk(file.Link, checkFirstByte)
|
||||
}
|
||||
|
||||
func (t *TorrentManager) GetKey(torrent *Torrent) string {
|
||||
|
||||
Reference in New Issue
Block a user