@@ -21,9 +21,9 @@ def parse_args():
2121 help = "Sort by priority, ratio, download, upload, download+upload, size, avg_size, remaining" ,
2222 )
2323
24- parser .add_argument (
25- "--force-start" , "--start" , action = argparse .BooleanOptionalAction , help = "Force start matching torrents"
26- )
24+ parser .add_argument ("--start" , action = argparse . BooleanOptionalAction , help = "Start matching torrents" )
25+ parser . add_argument ( "--force-start" , action = argparse .BooleanOptionalAction , help = "Force start matching torrents" )
26+ parser . add_argument ( "--check" , "--recheck" , action = "store_true" , help = "Check matching torrents" )
2727 parser .add_argument ("--stop" , action = "store_true" , help = "Stop matching torrents" )
2828 parser .add_argument ("--move" , help = "Directory to move folders/files" )
2929 parser .add_argument (
@@ -43,6 +43,9 @@ def parse_args():
4343
4444 arggroups .qBittorrent_torrents_post (args )
4545
46+ if args .move and not (args .stop or args .delete_rows or args .delete_files ):
47+ processes .exit_error ("--move requires --stop or --delete-rows" )
48+
4649 return args
4750
4851
@@ -83,7 +86,7 @@ def is_matching(args, t):
8386 if t .num_complete == 0 and t .seen_complete > 0
8487 else (
8588 t .added_on
86- if t .state in [' downloading' , ' forceDL' , ' stalledDL' , ' uploading' , ' forcedUP' , ' stalledUP' ]
89+ if t .state in [" downloading" , " forceDL" , " stalledDL" , " uploading" , " forcedUP" , " stalledUP" ]
8790 and t .num_complete == 0
8891 else 0
8992 )
@@ -114,6 +117,10 @@ def is_matching(args, t):
114117def filter_torrents_by_activity (args , torrents ):
115118 if args .stopped :
116119 torrents = [t for t in torrents if t .state_enum .is_stopped ]
120+ if args .errored :
121+ torrents = [t for t in torrents if t .state == "error" ]
122+ if args .missing :
123+ torrents = [t for t in torrents if t .state == "missingFiles" ]
117124 if args .complete :
118125 torrents = [t for t in torrents if t .state_enum .is_complete ]
119126 if args .incomplete :
@@ -351,14 +358,22 @@ def gen_row(t):
351358
352359 torrent_hashes = [t .hash for t in torrents ]
353360
354- if args .force_start is not None :
355- print ("Force-starting" , len (torrents ))
356- qbt_client .torrents_set_force_start (args .force_start , torrent_hashes = torrent_hashes )
357-
358361 if args .stop :
359362 print ("Stopping" , len (torrents ))
360363 qbt_client .torrents_stop (torrent_hashes = torrent_hashes )
361364
365+ if args .check :
366+ print ("Checking" , len (torrents ))
367+ qbt_client .torrents_recheck (torrent_hashes = torrent_hashes )
368+
369+ if args .start is not None :
370+ print ("Starting" , len (torrents ))
371+ qbt_client .torrents_start (torrent_hashes = torrent_hashes )
372+
373+ if args .force_start is not None :
374+ print ("Force-starting" , len (torrents ))
375+ qbt_client .torrents_set_force_start (args .force_start , torrent_hashes = torrent_hashes )
376+
362377 if args .delete_incomplete :
363378 for t in torrents :
364379 if not os .path .exists (t .content_path ):
@@ -375,7 +390,7 @@ def gen_row(t):
375390 if file .progress < args .delete_incomplete :
376391 path .unlink (missing_ok = True )
377392
378- if (args .stop or args .mark_deleted or args . delete_rows or args .delete_files ) and args .move :
393+ if (args .stop or args .delete_rows or args .delete_files ) and args .move :
379394 for t in torrents :
380395 if os .path .exists (t .content_path ):
381396 new_path = Path (args .move )
0 commit comments