Rework torrent manager handling of update

This commit is contained in:
Ben Sarmiento
2023-12-02 01:32:11 +01:00
parent 67f509248e
commit 2f7e3b0ca9
7 changed files with 228 additions and 232 deletions

View File

@@ -14,7 +14,7 @@ func HandleDeleteTorrent(directory, torrentName string, t *torrent.TorrentManage
if !torrents.Has(torrentName) {
return fmt.Errorf("cannot find torrent %s", torrentName)
}
t.Delete(torrentName)
t.Delete(torrentName, true, true)
return nil
}
@@ -23,15 +23,15 @@ func HandleDeleteFile(directory, torrentName, fileName string, t *torrent.Torren
if !ok {
return fmt.Errorf("cannot find directory %s", directory)
}
tor, ok := torrents.Get(torrentName)
torrent, ok := torrents.Get(torrentName)
if !ok {
return fmt.Errorf("cannot find torrent %s", torrentName)
}
file, ok := tor.SelectedFiles.Get(fileName)
file, ok := torrent.SelectedFiles.Get(fileName)
if !ok {
return fmt.Errorf("cannot find file %s", fileName)
}
file.Link = "unselect"
t.ScheduleForRefresh()
t.UpdateTorrentResponseCache(torrent)
return nil
}