Fix logic of fetching torrents

This commit is contained in:
Ben Sarmiento
2024-05-06 10:48:01 +02:00
parent b6b59b22e6
commit ae94252156
11 changed files with 205 additions and 49 deletions

View File

@@ -15,7 +15,7 @@ import (
)
func (t *TorrentManager) refreshTorrents(isInitialRun bool) []string {
instances, _, err := t.Api.GetTorrents(false)
instances, _, err := t.api.GetTorrents(false)
if err != nil {
t.log.Warnf("Cannot get torrents: %v", err)
return nil
@@ -72,6 +72,7 @@ func (t *TorrentManager) refreshTorrents(isInitialRun bool) []string {
t.assignedDirectoryCb(mainTor, func(directory string) {
listing, _ := t.DirectoryMap.Get(directory)
listing.Set(accessKey, mainTor)
updatedPaths = append(updatedPaths, fmt.Sprintf("%s/%s", directory, accessKey))
// this is just for the logs
if directory != config.ALL_TORRENTS {
@@ -151,7 +152,7 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
return diskTor
}
info, err := t.Api.GetTorrentInfo(rdTorrent.ID)
info, err := t.api.GetTorrentInfo(rdTorrent.ID)
if err != nil {
t.log.Warnf("Cannot get info for id=%s: %v", rdTorrent.ID, err)
return nil