upsies.uis.tui.commands.upload_images

Upload images to image hosting service

Classes

class upsies.uis.tui.commands.upload_images.upload_images(args, config)[source]

Bases: CommandBase

Upload images to image hosting service

names = ('upload-images', 'ui')

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 dict in which keys are option names or flags (e.g. "PATH" or ("--path", "-p") and each value is a dict with keyword arguments for argparse.ArgumentParser.add_argument().

Additionally, you may specify a group in each keyword argument dictionary. Arguments with the same group value are mutually exclusive, meaning the user can only specify one of them.

subcommand_name = 'IMAGE_HOST'

Reference to expected subcommand in help texts

subcommands = {'freeimage': {'cli': {'IMAGE': {'help': 'Path to image file', 'nargs': '+'}, ('--format', '-f'): {'default': None, 'help': 'Format string for each uploaded image\nUse {url} for the full-size image URL and {thumbnail} for the thumbnail URL\nExample: "[url={url}][img]{thumbnail}[/img][/url]"'}, ('--thumb-width', '--tw', '-t'): {'default': None, 'help': 'Thumbnail width in pixels or 0 for no thumbnail', 'metavar': 'WIDTH', 'type': <function integer>}}, 'description': ''}, 'imgbb': {'cli': {'IMAGE': {'help': 'Path to image file', 'nargs': '+'}, ('--format', '-f'): {'default': None, 'help': 'Format string for each uploaded image\nUse {url} for the full-size image URL and {thumbnail} for the thumbnail URL\nExample: "[url={url}][img]{thumbnail}[/img][/url]"'}, ('--thumb-width', '--tw', '-t'): {'default': None, 'help': 'Thumbnail width in pixels or 0 for no thumbnail', 'metavar': 'WIDTH', 'type': <function integer>}}, 'description': 'You need an API key to upload images. You can get one by following these steps:\n\n  1. Create an account: https://imgbb.com/signup\n  2. Go to https://api.imgbb.com/ and click on "Get API key".\n  3. Store your API key in ~/.config/upsies/imghosts.ini:\n\n       $ upsies set imghosts.imgbb.apikey <YOUR API KEY>'}, 'imgbox': {'cli': {'IMAGE': {'help': 'Path to image file', 'nargs': '+'}, ('--format', '-f'): {'default': None, 'help': 'Format string for each uploaded image\nUse {url} for the full-size image URL and {thumbnail} for the thumbnail URL\nExample: "[url={url}][img]{thumbnail}[/img][/url]"'}, ('--thumb-width', '--tw', '-t'): {'default': None, 'help': 'Thumbnail width in pixels or 0 for no thumbnail', 'metavar': 'WIDTH', 'type': <function integer>}}, 'description': ''}, 'pixhost': {'cli': {'IMAGE': {'help': 'Path to image file', 'nargs': '+'}, ('--format', '-f'): {'default': None, 'help': 'Format string for each uploaded image\nUse {url} for the full-size image URL and {thumbnail} for the thumbnail URL\nExample: "[url={url}][img]{thumbnail}[/img][/url]"'}, ('--thumb-width', '--tw', '-t'): {'default': None, 'help': 'Thumbnail width in pixels or 0 for no thumbnail', 'metavar': 'WIDTH', 'type': <function integer>}}, 'description': ''}, 'ptpimg': {'cli': {'IMAGE': {'help': 'Path to image file', 'nargs': '+'}, ('--format', '-f'): {'default': None, 'help': 'Format string for each uploaded image\nUse {url} for the full-size image URL and {thumbnail} for the thumbnail URL\nExample: "[url={url}][img]{thumbnail}[/img][/url]"'}, ('--thumb-width', '--tw', '-t'): {'default': None, 'help': 'Thumbnail width in pixels or 0 for no thumbnail', 'metavar': 'WIDTH', 'type': <function integer>}}, 'description': 'You need an API key to upload images.\n\n  1. Create an account: https://ptpimg.me/register.php\n  2. Store your API key in ~/.config/upsies/imghosts.ini:\n\n       $ upsies set --fetch-ptpimg-apikey EMAIL PASSWORD\n\n     If you already have your API key, store it like this:\n\n       $ upsies set imghosts.ptpimg.apikey YOUR_API_KEY'}, 'ra': {'cli': {'IMAGE': {'help': 'Path to image file', 'nargs': '+'}, ('--format', '-f'): {'default': None, 'help': 'Format string for each uploaded image\nUse {url} for the full-size image URL and {thumbnail} for the thumbnail URL\nExample: "[url={url}][img]{thumbnail}[/img][/url]"'}, ('--thumb-width', '--tw', '-t'): {'default': None, 'help': 'Thumbnail width in pixels or 0 for no thumbnail', 'metavar': 'WIDTH', 'type': <function integer>}}, 'description': 'You need an API key/token to upload images.\n\n  1. Go to https://thesungod.xyz/settings/profile -> API Key.\n  2. Fill in a token name and click on "Generate Token".\n  3. Store your "New Token" in ~/.config/upsies/imghosts.ini:\n\n       $ upsies set imghosts.ra.apikey YOUR_API_KEY'}, 'rfximg': {'cli': {'IMAGE': {'help': 'Path to image file', 'nargs': '+'}, ('--format', '-f'): {'default': None, 'help': 'Format string for each uploaded image\nUse {url} for the full-size image URL and {thumbnail} for the thumbnail URL\nExample: "[url={url}][img]{thumbnail}[/img][/url]"'}, ('--thumb-width', '--tw', '-t'): {'default': None, 'help': 'Thumbnail width in pixels or 0 for no thumbnail', 'metavar': 'WIDTH', 'type': <function integer>}}, 'description': 'You need an API key to upload images.\n\n  1. Go to your user page -> Settings -> Image host API key.\n  2. Click on "Generate image host API key".\n  3. Store the generated API key in ~/.config/upsies/imghosts.ini:\n\n       $ upsies set imghosts.rfximg.apikey YOUR_API_KEY'}}

Subcommands of commands (or subsubcommands from a CLI point of view)

This is a dict where keys are subcommand names and values are cli_arguments.

property imagehost_name

Lower-case image host name

property imagehost_config

Relevant section in image host configuration file combined with CLI arguments where CLI arguments take precedence unless their value is None

property jobs

Iterable of JobBase instances

Each JobBase instance may also be None for inactive jobs.