Add setting for hiding broken torrents

This commit is contained in:
Ben Adrian Sarmiento
2024-07-06 23:56:12 +02:00
parent acd18aca9a
commit 1373bbb975
5 changed files with 20 additions and 5 deletions

View File

@@ -51,7 +51,7 @@ func ServeTorrentsList(directory string, torMgr *torrent.TorrentManager) ([]byte
return buf.Bytes(), nil
}
func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManager) ([]byte, error) {
func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManager, shouldHideBrokenTorrents bool) ([]byte, error) {
torrents, ok := torMgr.DirectoryMap.Get(directory)
if !ok {
return nil, fmt.Errorf("cannot find directory %s", directory)
@@ -76,6 +76,9 @@ func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManage
if !ok || file.State.Is("deleted_file") {
continue
}
if file.State.Is("broken_file") && shouldHideBrokenTorrents {
continue
}
if dirCfg.OnlyShowTheBiggestFile && file.Bytes < biggestFileSize {
continue
}