Add token management
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
"github.com/debridmediamanager/zurg/internal/config"
|
||||
"github.com/debridmediamanager/zurg/internal/fs"
|
||||
"github.com/debridmediamanager/zurg/pkg/http"
|
||||
"github.com/debridmediamanager/zurg/pkg/logutil"
|
||||
"github.com/debridmediamanager/zurg/pkg/realdebrid"
|
||||
"github.com/debridmediamanager/zurg/pkg/utils"
|
||||
@@ -144,7 +143,7 @@ func (t *TorrentManager) UnrestrictFile(file *File) (*realdebrid.Download, error
|
||||
} else if file.State.Is("broken_file") {
|
||||
return nil, fmt.Errorf("file %s is broken", file.Path)
|
||||
}
|
||||
return t.rd.UnrestrictLink(file.Link)
|
||||
return t.rd.UnrestrictAndVerify(file.Link)
|
||||
}
|
||||
|
||||
func (t *TorrentManager) GetKey(torrent *Torrent) string {
|
||||
@@ -220,7 +219,7 @@ func (t *TorrentManager) applyMediaInfoDetails(torrent *Torrent) error {
|
||||
return
|
||||
}
|
||||
unrestrict, err := t.UnrestrictFile(file)
|
||||
if dlErr, ok := err.(*http.DownloadErrorResponse); ok && dlErr.Message == "bytes_limit_reached" {
|
||||
if utils.IsBWLimitExceeded(err) {
|
||||
bwLimitReached = true
|
||||
return
|
||||
}
|
||||
@@ -332,11 +331,8 @@ func (t *TorrentManager) deleteInfoFile(torrentID string) {
|
||||
/// end info functions
|
||||
|
||||
func (t *TorrentManager) mountNewDownloads() {
|
||||
token, _ := t.rd.GetToken()
|
||||
var tokenMap cmap.ConcurrentMap[string, *realdebrid.Download]
|
||||
if token != "" {
|
||||
tokenMap, _ = t.rd.UnrestrictMap.Get(token)
|
||||
}
|
||||
token := t.Config.GetToken()
|
||||
tokenMap, _ := t.rd.UnrestrictMap.Get(token)
|
||||
|
||||
downloads := t.rd.GetDownloads()
|
||||
mountedCount := 0
|
||||
|
||||
Reference in New Issue
Block a user