Add setting for hiding broken torrents
This commit is contained in:
@@ -59,7 +59,7 @@ func ServeTorrentsListForInfuse(directory string, torMgr *torrent.TorrentManager
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func ServeFilesListForInfuse(directory, torrentName string, torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
func ServeFilesListForInfuse(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)
|
||||
@@ -88,6 +88,9 @@ func ServeFilesListForInfuse(directory, torrentName string, torMgr *torrent.Torr
|
||||
if file.State.Is("deleted_file") {
|
||||
continue
|
||||
}
|
||||
if file.State.Is("broken_file") && shouldHideBrokenTorrents {
|
||||
continue
|
||||
}
|
||||
if dirCfg.OnlyShowTheBiggestFile && file.Bytes < biggestFileSize {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -54,7 +54,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)
|
||||
@@ -80,6 +80,9 @@ func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManage
|
||||
if file.State.Is("deleted_file") {
|
||||
continue
|
||||
}
|
||||
if file.State.Is("broken_file") && shouldHideBrokenTorrents {
|
||||
continue
|
||||
}
|
||||
if dirCfg.OnlyShowTheBiggestFile && file.Bytes < biggestFileSize {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user