diff --git a/qbtool.py b/qbtool.py index 62dedb2..bc3eb54 100644 --- a/qbtool.py +++ b/qbtool.py @@ -2,6 +2,7 @@ import re from argparse import ArgumentParser from collections import defaultdict +from functools import partial from itertools import chain from os import fspath from pathlib import Path @@ -415,6 +416,11 @@ def get_config(): return conf +def full_help(client, args, parsers): + for parser in parsers: + print(parser.format_help()) + + def main(): conf = get_config() @@ -448,7 +454,8 @@ def main(): parser_c.set_defaults(func=scrape_loaded) parser_d = subparsers.add_parser( - "move-by-availability", help="Moves torrents around on the harddrive based on number of seeders. NOT FULLY IMPLEMENTED YET!" + "move-by-availability", + help="Moves torrents around on the harddrive based on number of seeders. NOT FULLY IMPLEMENTED YET!", ) parser_d.add_argument("path", type=is_dir, help="Input directory") parser_d.add_argument( @@ -499,6 +506,10 @@ def main(): ) parser_g.set_defaults(func=find_torrents) + all_parsers = [parser, parser_a, parser_b, parser_c, parser_d, parser_e, parser_f, parser_g] + parser_h = subparsers.add_parser("full-help", help="Show full help, including subparsers") + parser_h.set_defaults(func=partial(full_help, parsers=all_parsers)) + args = parser.parse_args() if args.verbose: diff --git a/readme.md b/readme.md index 6b782c6..3b0f8c0 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,129 @@ # qb-tool -## usage notes +## Usage + +``` +usage: qbtool.py [-h] [--host HOST] [--username USERNAME] + [--password PASSWORD] [--recursive] [--verbose] + {categorize-failed-private,list-paused-private,scrape-loaded,move-by-availability,remove-loaded-torrents,move-by-rename,find-torrents,full-help} + ... + +positional arguments: + {categorize-failed-private,list-paused-private,scrape-loaded,move-by-availability,remove-loaded-torrents,move-by-rename,find-torrents,full-help} + categorize-failed-private + Move private torrents with failed tracker announces to + a special category. This can help to find torrents + which were removed from a private tracker, or anounce + urls with outdated API keys. + list-paused-private + List all paused private torrents + scrape-loaded Scrape all torrents and output results to file + move-by-availability + Moves torrents around on the harddrive based on number + of seeders. NOT FULLY IMPLEMENTED YET! + remove-loaded-torrents + Delete torrents files from directory if they are + already loaded in qBittorrent + move-by-rename b help + find-torrents Delete torrents files from directory if they are + already loaded in qBittorrent + full-help Show full help, including subparsers + +optional arguments: + -h, --help show this help message and exit + --host HOST qBittorrent web interface host and port + --username USERNAME qBittorrent web interface username + --password PASSWORD qBittorrent web interface password + --recursive + --verbose Show debug output + +usage: qbtool.py categorize-failed-private [-h] [--do-move] + [--category-name CATEGORY_NAME] + +optional arguments: + -h, --help show this help message and exit + --do-move Actually move them, otherwise the moves are only + printed + --category-name CATEGORY_NAME + Name of category to assign torrents to + +usage: qbtool.py list-paused-private [-h] path + +positional arguments: + path Input directory + +optional arguments: + -h, --help show this help message and exit + +usage: qbtool.py scrape-loaded [-h] [--out OUT] path + +positional arguments: + path Input directory + +optional arguments: + -h, --help show this help message and exit + --out OUT Path to write scraped file info to + +usage: qbtool.py move-by-availability [-h] [--scrapes-file SCRAPES_FILE] + [--do-move] + path + +positional arguments: + path Input directory + +optional arguments: + -h, --help show this help message and exit + --scrapes-file SCRAPES_FILE + Created by the scrape-loaded command. + --do-move Actually move them, otherwise the moves are only + printed + +usage: qbtool.py remove-loaded-torrents [-h] [--do-remove] path [path ...] + +positional arguments: + path Input directory + +optional arguments: + -h, --help show this help message and exit + --do-remove + +usage: qbtool.py move-by-rename [-h] --src SRC --dest DEST [--do-move] + [--case-sensitive] [--regex] [--match-start] + [--match-end] + +optional arguments: + -h, --help show this help message and exit + --src SRC Source path pattern + --dest DEST Destination path pattern + --do-move Actually move them, otherwise the moves are only printed + --case-sensitive + --regex Use regex for src and dest + --match-start Only match if src is found at the start of the path + --match-end Only match if src is found at the end of the path + +usage: qbtool.py find-torrents [-h] --torrents-dirs TORRENTS_DIRS + [TORRENTS_DIRS ...] --data-dirs DATA_DIRS + [DATA_DIRS ...] [--do-add] + [--ignore-top-level-dir] + +optional arguments: + -h, --help show this help message and exit + --torrents-dirs TORRENTS_DIRS [TORRENTS_DIRS ...] + Directory with torrent files + --data-dirs DATA_DIRS [DATA_DIRS ...] + Directory to look for torrent data + --do-add Actually add the torrents to qBittorrent, otherwise + just print found ones + --ignore-top-level-dir + Ignore the name of the top level dir. This will help + to find torrents where no sub-folder was created. + +``` + +## Config + +Some of the main arguments like username and password can be put into a config file at `/Dobatymo/qb-tool/config.json`. For Windows this defaults to `C:\Users\\AppData\Local\Dobatymo\qb-tool\config.json` + +## Usage notes - `py qbtool.py move-by-rename --src "/movie" --dest "/film"` will match `/movie/`, but also `/movies-old/` and others. So either use `--src /movie/` or add `--match-end`