upsies.uis.tui.commands.torrent
Commands related to torrent files
Classes
- class upsies.uis.tui.commands.torrent.torrent_add(args, config)[source]
Bases:
CommandBaseAdd torrent file to BitTorrent client
- names = ('torrent-add', 'ta')
Sequence of command names
The first name is the full name and the rest are short aliases.
- cli_arguments = {'CLIENT': {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.'}, 'TORRENT': {'help': 'Path to torrent file', 'nargs': '+'}, ('--download-path', '-p'): {'help': "Parent directory of the torrent's content", 'metavar': 'DIRECTORY'}}
CLI argument definitions for this command
This is a
dictin which keys are option names or flags (e.g."PATH"or("--path", "-p")and each value is adictwith keyword arguments forargparse.ArgumentParser.add_argument().Additionally, you may specify a
groupin each keyword argument dictionary. Arguments with the samegroupvalue are mutually exclusive, meaning the user can only specify one of them.
- class upsies.uis.tui.commands.torrent.torrent_create(args, config)[source]
Bases:
CommandBaseCreate torrent file and optionally add or copy it
The piece hashes are cached and re-used if possible. This means the torrent is not generated for every tracker again. Note that the torrent is always generated if files are excluded on one tracker but not on the other. The files in each torrent must be identical.
- names = ('torrent-create', 'tc')
Sequence of command names
The first name is the full name and the rest are short aliases.
- cli_arguments = {}
CLI argument definitions for this command
This is a
dictin which keys are option names or flags (e.g."PATH"or("--path", "-p")and each value is adictwith keyword arguments forargparse.ArgumentParser.add_argument().Additionally, you may specify a
groupin each keyword argument dictionary. Arguments with the samegroupvalue are mutually exclusive, meaning the user can only specify one of them.
- subcommand_name = 'TRACKER'
Reference to expected subcommand in help texts
- subcommands = {'ant': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for ANT in the current working directory.'}, 'bhd': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for BHD in the current working directory.'}, 'cbr': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for CBR in the current working directory.'}, 'fld': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for FLD in the current working directory.'}, 'mtv': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for MTV in the current working directory.'}, 'nbl': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for NBL in the current working directory.'}, 'ptp': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for PTP in the current working directory.'}, 'rfx': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for RFX in the current working directory.'}, 'sc': {'cli': {'CONTENT': {'help': 'Path to release content', 'type': <function content>}, ('--add-to', '-a'): {'help': 'BitTorrent client name.\nValid names are section names in ~/.config/upsies/clients.ini.', 'metavar': 'CLIENT'}, ('--copy-to', '-c'): {'help': 'Copy the created torrent to PATH (file or directory)', 'metavar': 'PATH'}, ('--exclude-files', '--ef'): {'action': 'extend', 'default': [], 'help': 'Glob pattern to exclude from torrent (matched case-insensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+'}, ('--exclude-files-regex', '--efr'): {'action': 'extend', 'default': [], 'help': 'Regular expression to exclude from torrent (matched case-sensitively against path in torrent)', 'metavar': 'PATTERN', 'nargs': '+', 'type': <function regex>}, ('--reuse-torrent', '-t'): {'action': 'extend', 'default': [], 'help': "Use hashed pieces from TORRENT instead of generating them again or getting them from ~/.cache/upsies/generic_torrents\nTORRENT may also be a directory, which is searched recursively for a matching *.torrent file.\nNOTE: This option is ignored if TORRENT doesn't match CONTENT properly.", 'metavar': 'TORRENT', 'nargs': '+', 'type': <function existing_path>}}, 'description': 'Create a torrent file for SC in the current working directory.'}}
Subcommands of commands (or subsubcommands from a CLI point of view)
This is a
dictwhere keys are subcommand names and values arecli_arguments.
- property home_directory
Create torrent file in current working directory