Repair works now

This commit is contained in:
Ben Sarmiento
2024-05-23 21:45:20 +02:00
parent d03b59bb2a
commit 8636a0569d
4 changed files with 29 additions and 47 deletions

View File

@@ -483,17 +483,12 @@ func (t *TorrentManager) canCapacityHandle() bool {
}
func (t *TorrentManager) markAsUnplayable(torrent *Torrent, reason string) {
if torrent.State.Is("unplayable_torrent") {
return
}
t.log.Warnf("Marking torrent %s as unplayable - %s", t.GetKey(torrent), reason)
if err := torrent.State.Event(context.Background(), "mark_as_unplayable_torrent"); err != nil {
t.log.Errorf("Failed to mark torrent %s as unplayable: %v", t.GetKey(torrent), err)
return
}
t.writeTorrentToFile(torrent)
t.log.Warnf("Torrent %s is unplayable (reason: %s), moving to unplayable directory", t.GetKey(torrent), reason)
// reassign to unplayable torrents directory
t.DirectoryMap.IterCb(func(directory string, torrents cmap.ConcurrentMap[string, *Torrent]) {
if strings.HasPrefix(directory, "int__") {
return
}
torrents.Remove(t.GetKey(torrent))
})
torrents, _ := t.DirectoryMap.Get(config.UNPLAYABLE_TORRENTS)