Skip to content

Commit 73b7bbf

Browse files
committed
add file count filter
1 parent 8363a7b commit 73b7bbf

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

library/playback/torrents_info.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def filter_torrents_by_activity(args, torrents):
115115
def filter_torrents_by_criteria(args, torrents):
116116
if "sizes" not in args.defaults:
117117
torrents = [t for t in torrents if args.sizes(t.total_size)]
118+
if "file_count" not in args.defaults:
119+
torrents = [t for t in torrents if args.file_count(len(t.files))]
118120
if "avg_sizes" not in args.defaults:
119121
torrents = [t for t in torrents if args.avg_sizes(median([f.size for f in t.files]))]
120122
if "ratio" not in args.defaults:

library/utils/arggroups.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,6 +2031,7 @@ def qBittorrent_torrents(parent_parser):
20312031
action="append",
20322032
help="""Include torrents constrained by average file sizes (uses the same syntax as fd-find)""",
20332033
)
2034+
parser.add_argument("--file-count", "--files", action="append", help="Include torrents constrained by total file counts")
20342035
parser.add_argument("--seeders", action="append", help="Include torrents with N seeders")
20352036
parser.add_argument("--leechers", action="append", help="Include torrents with N leechers")
20362037
parser.add_argument("--time-added", action="append", help="Include torrents with N time since added")
@@ -2069,7 +2070,7 @@ def qBittorrent_torrents(parent_parser):
20692070
)
20702071

20712072
parser.add_argument(
2072-
"--file-counts", "--files", "--counts", action="store_true", help="Include file counts column (a bit slow)"
2073+
"--file-counts", action="store_true", help="Include file counts column (a bit slow)"
20732074
)
20742075
parser.add_argument("--trackers", action="store_true", help="Include tracker column")
20752076
parser.add_argument("--status", "--state", action="store_true", help="Include state column")
@@ -2098,6 +2099,7 @@ def qBittorrent_torrents_post(args):
20982099
args.remaining = sql_utils.parse_human_to_lambda(nums.human_to_bytes, args.remaining)
20992100
args.uploaded = sql_utils.parse_human_to_lambda(nums.human_to_bytes, args.uploaded)
21002101
args.avg_sizes = sql_utils.parse_human_to_lambda(nums.human_to_bytes, args.avg_sizes)
2102+
args.file_count = sql_utils.parse_human_to_lambda(int, args.file_count)
21012103

21022104
args.priority = sql_utils.parse_human_to_lambda(int, args.priority)
21032105
args.seeders = sql_utils.parse_human_to_lambda(int, args.seeders)

0 commit comments

Comments
 (0)