Group all unplayable torrents in a separate directory
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/debridmediamanager/zurg/internal/config"
|
||||
"github.com/debridmediamanager/zurg/pkg/realdebrid"
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
cmap "github.com/orcaman/concurrent-map/v2"
|
||||
@@ -59,7 +60,7 @@ func (t *TorrentManager) RefreshTorrents() []string {
|
||||
// assign to directories
|
||||
tor, ok := allTorrents.Get(accessKey)
|
||||
if !ok {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
var directories []string
|
||||
t.assignedDirectoryCb(tor, func(directory string) {
|
||||
@@ -69,18 +70,19 @@ func (t *TorrentManager) RefreshTorrents() []string {
|
||||
torrents, _ := t.DirectoryMap.Get(directory)
|
||||
torrents.Set(accessKey, tor)
|
||||
updatedPaths = append(updatedPaths, fmt.Sprintf("%s/%s", directory, accessKey))
|
||||
if directory != "__all__" {
|
||||
// this is just for the logs
|
||||
if directory != config.ALL_TORRENTS {
|
||||
directories = append(directories, directory)
|
||||
}
|
||||
})
|
||||
t.log.Debugf("Added %s to %v", accessKey, directories)
|
||||
t.allAccessKeys.Add(accessKey)
|
||||
return true
|
||||
return false
|
||||
})
|
||||
// removed torrents
|
||||
t.allAccessKeys.Difference(freshKeys).Each(func(accessKey string) bool {
|
||||
t.Delete(accessKey, false)
|
||||
return true
|
||||
return false
|
||||
})
|
||||
|
||||
return updatedPaths
|
||||
@@ -212,7 +214,7 @@ func (t *TorrentManager) mergeToMain(existing, toMerge *Torrent) Torrent {
|
||||
toMerge.DownloadedIDs.Difference(existing.DownloadedIDs).Each(func(id string) bool {
|
||||
mainTorrent.DownloadedIDs.Add(id)
|
||||
mainTorrent.InProgressIDs.Remove(id)
|
||||
return true
|
||||
return false
|
||||
})
|
||||
|
||||
// the link can have the following values
|
||||
|
||||
Reference in New Issue
Block a user