Introduce components
This commit is contained in:
@@ -12,16 +12,7 @@ func (t *TorrentManager) CheckDeletedStatus(torrent *Torrent) bool {
|
||||
if len(deletedIDs) == torrent.SelectedFiles.Count() && len(deletedIDs) > 0 {
|
||||
return true
|
||||
} else if len(deletedIDs) > 0 {
|
||||
t.saveTorrentChangesToDisk(torrent, func(info *Torrent) {
|
||||
info.SelectedFiles.IterCb(func(_ string, file *File) {
|
||||
for _, deletedID := range deletedIDs {
|
||||
if file.ID == deletedID {
|
||||
file.IsDeleted = true
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
t.writeTorrentToFile(torrent)
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -29,15 +20,12 @@ func (t *TorrentManager) CheckDeletedStatus(torrent *Torrent) bool {
|
||||
func (t *TorrentManager) Delete(accessKey string, deleteInRD bool) {
|
||||
allTorrents, _ := t.DirectoryMap.Get(INT_ALL)
|
||||
if deleteInRD {
|
||||
infoCache, _ := t.DirectoryMap.Get(INT_INFO_CACHE)
|
||||
if torrent, ok := allTorrents.Get(accessKey); ok {
|
||||
torrent.DownloadedIDs.Union(torrent.InProgressIDs).Each(func(id string) bool {
|
||||
t.log.Debugf("Deleting torrent %s (id=%s) in RD", accessKey, id)
|
||||
t.api.DeleteTorrent(id)
|
||||
infoCache.Remove(id)
|
||||
t.deleteTorrentFile(id)
|
||||
return false
|
||||
})
|
||||
for torrentID := range torrent.Components {
|
||||
t.log.Debugf("Deleting torrent %s (id=%s) in RD", accessKey, torrentID)
|
||||
t.api.DeleteTorrent(torrentID)
|
||||
t.deleteInfoFile(torrentID)
|
||||
}
|
||||
}
|
||||
}
|
||||
t.log.Infof("Removing torrent %s from zurg database (not real-debrid)", accessKey)
|
||||
|
||||
Reference in New Issue
Block a user