7575 "images_to_pdf" : "Convert folders of images into image PDFs" ,
7676 "pdf_edit" : "Apply brightness, contrast, saturation, and sharpness adjustments to PDFs" ,
7777 "torrents_start" : "Start torrents (qBittorrent-nox)" ,
78- "torrents_stop" : "Stop torrents (qBittorrent-nox)" ,
78+ "torrents_stop" : "Stop seeding torrents (qBittorrent-nox)" ,
79+ "torrents_stop_incomplete" : "Stop downloading torrents (qBittorrent-nox)" ,
7980 },
8081 "Multi-database subcommands" : {
8182 "merge_dbs" : "Merge SQLite databases" ,
108109 "tabs_open" : "Open your tabs for the day" ,
109110 "links_open" : "Open links from link dbs" ,
110111 "surf" : "Auto-load browser tabs in a streaming way (stdin)" ,
112+ "torrents_info" : "List torrents (qBittorrent-nox)" ,
111113 },
112114 "Database enrichment subcommands" : {
113115 "dedupe_db" : "Dedupe SQLite tables" ,
@@ -227,6 +229,7 @@ def print_help(parser) -> None:
227229 "xklb.mediafiles.pdf_edit.pdf_edit" : [],
228230 "xklb.mediafiles.torrents_start.torrents_start" : ["torrent-start" ],
229231 "xklb.mediafiles.torrents_stop.torrents_stop" : ["torrent-stop" ],
232+ "xklb.mediafiles.torrents_stop_incomplete.torrents_stop_incomplete" : ["torrent-stop-incomplete" ],
230233 "xklb.misc.dedupe_czkawka.czkawka_dedupe" : ["dedupe-czkawka" ],
231234 "xklb.misc.export_text.export_text" : [],
232235 "xklb.multidb.copy_play_counts.copy_play_counts" : [],
@@ -242,10 +245,11 @@ def print_help(parser) -> None:
242245 "xklb.playback.playback_control.playback_next" : ["next" ],
243246 "xklb.playback.playback_control.playback_now" : ["now" ],
244247 "xklb.playback.playback_control.playback_pause" : ["pause" , "play" ],
245- "xklb.playback.playback_control.playback_stop" : ["stop" ],
246248 "xklb.playback.playback_control.playback_seek" : ["ffwd" , "rewind" , "seek" ], # TODO: make rewind negative...
249+ "xklb.playback.playback_control.playback_stop" : ["stop" ],
247250 "xklb.playback.surf.streaming_tab_loader" : ["surf" ],
248251 "xklb.playback.tabs_open.tabs_open" : ["tb" , "tabs" , "open_tabs" ],
252+ "xklb.playback.torrents_info.torrents_info" : ["torrent-info" , "torrents" , "torrent" ],
249253 "xklb.tablefiles.eda.eda" : ["preview" ],
250254 "xklb.tablefiles.incremental_diff.incremental_diff" : [],
251255 "xklb.tablefiles.columns.columns" : [],
@@ -277,7 +281,20 @@ def create_subcommands_parser() -> argparse.ArgumentParser:
277281 subparsers = parser .add_subparsers ()
278282
279283 # this needs to stay inside the function to prevent side-effects during testing
280- known_subcommands = ["fs" , "media" , "open" , "table" , "tables" , "tabs" , "du" , "search" , "links" , "images" ]
284+ known_subcommands = [
285+ "fs" ,
286+ "media" ,
287+ "open" ,
288+ "table" ,
289+ "tables" ,
290+ "tabs" ,
291+ "du" ,
292+ "search" ,
293+ "links" ,
294+ "images" ,
295+ "torrents" ,
296+ "torrent" ,
297+ ]
281298
282299 def consecutive_prefixes (s ):
283300 prefixes = [s [:j ] for j in range (5 , len (s )) if s [:j ] and s [:j ] not in known_subcommands ]
@@ -325,7 +342,12 @@ def add_parser(subparsers, func, aliases=None):
325342
326343def library (args = None ) -> None :
327344 if args :
328- sys .argv = ["lb" , * args ]
345+ original_argv = sys .argv
346+ try :
347+ sys .argv = ["lb" , * args ]
348+ return library ()
349+ finally :
350+ sys .argv = original_argv
329351
330352 parser .exit_on_error = False # type: ignore
331353 try :
0 commit comments