Send to unplayable directory

This commit is contained in:
Ben Sarmiento
2024-01-07 15:14:23 +01:00
parent 72f7b0f1e5
commit 56a07709f6
2 changed files with 9 additions and 3 deletions

View File

@@ -64,9 +64,6 @@ func (t *TorrentManager) RefreshTorrents() []string {
} }
var directories []string var directories []string
t.assignedDirectoryCb(tor, func(directory string) { t.assignedDirectoryCb(tor, func(directory string) {
if strings.HasPrefix(directory, "int__") {
return
}
torrents, _ := t.DirectoryMap.Get(directory) torrents, _ := t.DirectoryMap.Get(directory)
torrents.Set(accessKey, tor) torrents.Set(accessKey, tor)
updatedPaths = append(updatedPaths, fmt.Sprintf("%s/%s", directory, accessKey)) updatedPaths = append(updatedPaths, fmt.Sprintf("%s/%s", directory, accessKey))

View File

@@ -6,7 +6,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/debridmediamanager/zurg/internal/config"
"github.com/debridmediamanager/zurg/pkg/realdebrid" "github.com/debridmediamanager/zurg/pkg/realdebrid"
cmap "github.com/orcaman/concurrent-map/v2"
) )
const EXPIRED_LINK_TOLERANCE_HOURS = 24 const EXPIRED_LINK_TOLERANCE_HOURS = 24
@@ -115,7 +117,9 @@ func (t *TorrentManager) repair(torrent *Torrent) {
if assignedCount > 0 { if assignedCount > 0 {
t.log.Infof("Assigned %d links to selected files for torrent %s", assignedCount, torrent.AccessKey) t.log.Infof("Assigned %d links to selected files for torrent %s", assignedCount, torrent.AccessKey)
} else if rarCount > 0 { } else if rarCount > 0 {
// this is a rar'ed torrent, nothing we can do
if t.Config.ShouldDeleteRarFiles() { if t.Config.ShouldDeleteRarFiles() {
t.log.Warnf("Torrent %s is rar'ed and we cannot repair it, deleting it as configured", torrent.AccessKey)
t.Delete(torrent.AccessKey, true) t.Delete(torrent.AccessKey, true)
} else { } else {
for _, unassigned := range unassignedDownloads { for _, unassigned := range unassignedDownloads {
@@ -131,6 +135,11 @@ func (t *TorrentManager) repair(torrent *Torrent) {
} }
torrent.SelectedFiles.Set(unassigned.Filename, newFile) torrent.SelectedFiles.Set(unassigned.Filename, newFile)
} }
t.DirectoryMap.IterCb(func(directory string, torrents cmap.ConcurrentMap[string, *Torrent]) {
torrents.Remove(torrent.AccessKey)
})
torrents, _ := t.DirectoryMap.Get(config.UNPLAYABLE_TORRENTS)
torrents.Set(torrent.AccessKey, torrent)
} }
return return
} }