delete functionality

This commit is contained in:
Ben Sarmiento
2023-11-21 13:10:48 +01:00
parent 3901230943
commit 849dbb97dd
8 changed files with 135 additions and 32 deletions

View File

@@ -548,6 +548,17 @@ func (t *TorrentManager) repairAll() {
})
}
func (t *TorrentManager) Delete(accessKey string) {
t.log.Infof("Deleting torrent %s", accessKey)
allTorrents, _ := t.DirectoryMap.Get(ALL_TORRENTS)
if torrent, ok := allTorrents.Get(accessKey); ok {
for _, instance := range torrent.Instances {
t.api.DeleteTorrent(instance.ID)
}
allTorrents.Remove(accessKey)
}
}
func (t *TorrentManager) Repair(accessKey string) {
if !t.cfg.EnableRepair() {
t.log.Warn("Repair is disabled; if you do not have other zurg instances running, you should enable repair")