do not overwrite info

This commit is contained in:
Ben Sarmiento
2024-01-11 06:55:31 +01:00
parent 3cdc2f8791
commit 628e3d6345
3 changed files with 40 additions and 10 deletions

View File

@@ -14,8 +14,20 @@ func (t *TorrentManager) CheckDeletedStatus(torrent *Torrent) bool {
} else if len(unselectedIDs) > 0 {
infoCache, _ := t.DirectoryMap.Get(INT_INFO_CACHE)
torrent.DownloadedIDs.Each(func(id string) bool {
infoCache.Set(id, torrent)
t.writeTorrentToFile(id, torrent, false)
info, _ := infoCache.Get(id)
info.SelectedFiles.IterCb(func(_ string, file *File) {
found := false
for _, unselectedID := range unselectedIDs {
if file.ID == unselectedID {
found = true
break
}
}
if found {
file.Link = "unselect"
}
})
t.writeTorrentToFile(id, info, false)
return false
})
}