@@ -36,6 +36,10 @@ def parse_args():
36
36
parser .add_argument ("--move" , type = Path , help = "Directory to move folders/files" )
37
37
parser .add_argument ("--start" , action = argparse .BooleanOptionalAction , help = "Start matching torrents" )
38
38
parser .add_argument ("--force-start" , action = argparse .BooleanOptionalAction , help = "Force start matching torrents" )
39
+ parser .add_argument ("--download-limit" , "--dl-limit" , type = nums .human_to_bytes , help = "Torrent download limit" )
40
+ parser .add_argument (
41
+ "--upload-limit" , "--up-limit" , "--ul-limit" , type = nums .human_to_bytes , help = "Torrent upload limit"
42
+ )
39
43
parser .add_argument ("--check" , "--recheck" , action = "store_true" , help = "Check matching torrents" )
40
44
parser .add_argument ("--export" , action = "store_true" , help = "Export matching torrent files" )
41
45
@@ -174,9 +178,6 @@ def filter_torrents_by_criteria(args, torrents):
174
178
if args .no_tracker :
175
179
trackers = set (args .no_tracker )
176
180
torrents = [t for t in torrents if t .tracker_domain () not in trackers ]
177
- if args .tracker :
178
- trackers = set (args .tracker )
179
- torrents = [t for t in torrents if t .tracker_domain () in trackers ]
180
181
if args .torrent_search :
181
182
torrents = [
182
183
t
@@ -188,6 +189,10 @@ def filter_torrents_by_criteria(args, torrents):
188
189
if args .file_search :
189
190
torrents = [t for t in torrents if strings .glob_match (args .file_search , [f .name for f in t .files ])]
190
191
192
+ if args .tracker :
193
+ trackers = set (args .tracker )
194
+ torrents = [t for t in torrents if t .tracker_domain () in trackers ]
195
+
191
196
if args .timeout_size :
192
197
torrents = [t for t in torrents if not processes .sizeout (args .timeout_size , t .total_size )]
193
198
@@ -568,6 +573,14 @@ def set_download_path(t, download_path):
568
573
print ("Force-starting" , len (torrents ))
569
574
qbt_client .torrents_set_force_start (args .force_start , torrent_hashes = torrent_hashes )
570
575
576
+ if args .download_limit is not None :
577
+ print ("Setting DL limit" , len (torrents ))
578
+ qbt_client .torrents_set_download_limit (args .download_limit or - 1 , torrent_hashes = torrent_hashes )
579
+
580
+ if args .upload_limit is not None :
581
+ print ("Setting UP limit" , len (torrents ))
582
+ qbt_client .torrents_set_upload_limit (args .upload_limit or - 1 , torrent_hashes = torrent_hashes )
583
+
571
584
if args .check :
572
585
print ("Checking" , len (torrents ))
573
586
qbt_client .torrents_recheck (torrent_hashes = torrent_hashes )
0 commit comments