Reimplement deletes and marking files as broken

This commit is contained in:
Ben Sarmiento
2024-01-29 22:28:27 +01:00
parent 1615c9e121
commit b505400f60
12 changed files with 64 additions and 112 deletions

View File

@@ -29,14 +29,14 @@ func HandleDeleteFile(directory, torrentName, fileName string, torMgr *torrent.T
return fmt.Errorf("cannot find torrent %s", torrentName)
}
file, ok := torrent.SelectedFiles.Get(fileName)
if !ok {
if !ok || file.IsDeleted {
return fmt.Errorf("cannot find file %s", fileName)
}
dirCfg := torMgr.Config.(*config.ZurgConfigV1).GetDirectoryConfig(directory)
if dirCfg.OnlyShowTheBiggestFile {
torMgr.Delete(torrentName, true)
} else {
file.Link = "unselect"
file.IsDeleted = true
if torMgr.CheckDeletedStatus(torrent) {
torMgr.Delete(torrentName, true)
}