Ejemplo n.º 1
0
def register_parser_arguments():
    exec_parser = options.get_parser('execute')
    inject_parser = options.register_command(
        'inject',
        do_cli,
        add_help=False,
        parents=[exec_parser],
        help='inject an entry from command line into tasks',
        usage='%(prog)s title [url] [--accept] [--force] '
        '[--fields NAME=VALUE [NAME=VALUE...]] [<execute arguments>]')
    inject_group = inject_parser.add_argument_group('inject arguments')
    inject_group.add_argument('title', help='title of the entry to inject')
    inject_group.add_argument('url',
                              nargs='?',
                              help='url of the entry to inject')
    inject_group.add_argument(
        '--force',
        action='store_true',
        help='prevent any plugins from rejecting this entry')
    inject_group.add_argument(
        '--accept',
        action='store_true',
        help='accept this entry immediately upon injection')
    inject_group.add_argument('--fields',
                              metavar='NAME=VALUE',
                              nargs='+',
                              type=key_equals_value)
    # Hack the title of the exec options a bit (would be 'optional arguments' otherwise)
    inject_parser._action_groups[1].title = 'execute arguments'
    # The exec arguments show first... unless we switch them
    inject_parser._action_groups.remove(inject_group)
    inject_parser._action_groups.insert(0, inject_group)
Ejemplo n.º 2
0
def register_parser_arguments():
    # Register the command
    parser = options.register_command('series', do_cli, help='view and manipulate the series plugin database')

    # Parent parser for subcommands that need a series name
    series_parser = argparse.ArgumentParser(add_help=False)
    series_parser.add_argument('series_name', help='the name of the series', metavar='<series name>')

    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='series_action')
    list_parser = subparsers.add_parser('list', help='list a summary of the different series being tracked')
    list_parser.add_argument('configured', nargs='?', choices=['configured', 'unconfigured', 'all'],
                             default='configured',
                             help='limit list to series that are currently in the config or not (default: %(default)s)')
    list_parser.add_argument('--premieres', action='store_true',
                             help='limit list to series which only have episode 1 (and maybe also 2) downloaded')
    list_parser.add_argument('--new', nargs='?', type=int, metavar='DAYS', const=7,
                             help='limit list to series with a release seen in last %(const)s days. number of days can '
                                  'be overridden with %(metavar)s')
    list_parser.add_argument('--stale', nargs='?', type=int, metavar='DAYS', const=365,
                             help='limit list to series which have not seen a release in %(const)s days. number of '
                                  'days can be overridden with %(metavar)s')
    list_parser.add_argument('--porcelain', action='store_true', help='make the output parseable')
    show_parser = subparsers.add_parser('show', parents=[series_parser],
                                        help='show the releases FlexGet has seen for a given series ')
    begin_parser = subparsers.add_parser('begin', parents=[series_parser],
                                         help='set the episode to start getting a series from')
    begin_parser.add_argument('episode_id', metavar='<episode ID>',
                              help='episode ID to start getting the series from (e.g. S02E01, 2013-12-11, or 9, '
                                   'depending on how the series is numbered)')
    forget_parser = subparsers.add_parser('forget', parents=[series_parser],
                                          help='removes episodes or whole series from the series database')
    forget_parser.add_argument('episode_id', nargs='?', default=None, help='episode ID to forget (optional)')
Ejemplo n.º 3
0
def register_parser_arguments():
    # Register the command
    parser = options.register_command('series', do_cli, help='View and manipulate the series plugin database')

    # Parent parser for subcommands that need a series name
    series_parser = argparse.ArgumentParser(add_help=False)
    series_parser.add_argument('series_name', help='The name of the series', metavar='<series name>')

    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='series_action')
    list_parser = subparsers.add_parser('list', parents=[table_parser],
                                        help='List a summary of the different series being tracked')
    list_parser.add_argument('configured', nargs='?', choices=['configured', 'unconfigured', 'all'],
                             help='Limit list to series that are currently in the config or not (default: %(default)s)')
    list_parser.add_argument('--premieres', action='store_true',
                             help='limit list to series which only have episode 1 (and maybe also 2) downloaded')
    list_parser.add_argument('--new', nargs='?', type=int, metavar='DAYS', const=7,
                             help='Limit list to series with a release seen in last %(const)s days. number of days can '
                                  'be overridden with %(metavar)s')
    list_parser.add_argument('--stale', nargs='?', type=int, metavar='DAYS', const=365,
                             help='Limit list to series which have not seen a release in %(const)s days. number of '
                                  'days can be overridden with %(metavar)s')
    list_parser.add_argument('--sort-by', choices=('name', 'age'), help='Choose list sort attribute')
    order = list_parser.add_mutually_exclusive_group(required=False)
    order.add_argument('--descending', dest='order', action='store_const', const='desc', help='Sort in descending order')
    order.add_argument('--ascending', dest='order', action='store_const', const='asc', help='Sort in ascending order')

    show_parser = subparsers.add_parser('show', parents=[series_parser, table_parser],
                          help='Show the releases FlexGet has seen for a given series')
    show_parser.add_argument('--sort-by', choices=('age', 'identifier'),
                             help='Choose releases list sort: age (default) or identifier')
    show_order = show_parser.add_mutually_exclusive_group(required=False)
    show_order.add_argument('--descending', dest='order', action='store_const', const='desc',
                            help='Sort in descending order')
    show_order.add_argument('--ascending', dest='order', action='store_const', const='asc',
                            help='Sort in ascending order')

    begin_parser = subparsers.add_parser('begin', parents=[series_parser],
                                         help='set the episode to start getting a series from')
    begin_opts = begin_parser.add_mutually_exclusive_group(required=True)
    begin_opts.add_argument('--forget', dest='forget', action='store_true', help='Forget begin episode', required=False)
    begin_opts.add_argument('episode_id', metavar='<episode ID>',
                              help='Episode ID to start getting the series from (e.g. S02E01, 2013-12-11, or 9, '
                                   'depending on how the series is numbered). You can also enter a season ID such as '
                                   ' S02.', nargs='?', default='')

    addshow_parser = subparsers.add_parser('add', parents=[series_parser],
                                           help='Add episode(s) and season(s) to series history')
    addshow_parser.add_argument('entity_id', nargs='+', default=None, metavar='<entity_id>',
                                help='Episode or season entity ID(s) to add')
    addshow_parser.add_argument('--quality', default=None, metavar='<quality>',
                                help='Quality string to be stored for all entity ID(s)')

    forget_parser = subparsers.add_parser('forget', parents=[series_parser],
                                          help='Removes episodes or whole series from the entire database '
                                               '(including seen plugin)')
    forget_parser.add_argument('episode_id', nargs='*', default=None, help='Entity ID(s) to forget (optional)')
    delete_parser = subparsers.add_parser('remove', parents=[series_parser],
                                          help='Removes episodes or whole series from the series database only')
    delete_parser.add_argument('episode_id', nargs='*', default=None, help='Episode ID to forget (optional)')
Ejemplo n.º 4
0
def register_parser_arguments():
    plugins_parser = ArgumentParser(add_help=False)
    plugins_parser.add_argument(
        'plugin_name', help="Name of plugin to reset", nargs=1, choices=list(plugin_schemas)
    )

    parser = options.register_command(
        'database', do_cli, help='Utilities to manage the FlexGet database'
    )
    subparsers = parser.add_subparsers(title='Actions', metavar='<action>', dest='db_action')
    subparsers.add_parser(
        'cleanup', help='Make all plugins clean un-needed data from the database'
    )
    subparsers.add_parser(
        'vacuum', help='Running vacuum can increase performance and decrease database size'
    )
    reset_parser = subparsers.add_parser(
        'reset', add_help=False, help='Reset the entire database (DANGEROUS!)'
    )
    reset_parser.add_argument(
        '--sure',
        action='store_true',
        required=True,
        help='You must use this flag to indicate you REALLY want to do this',
    )
    subparsers.add_parser(
        'reset-plugin', help='Reset the database for a specific plugin', parents=[plugins_parser]
    )
Ejemplo n.º 5
0
def register_parser_arguments():
    plugins_subparser = options.register_command(
        'plugins', plugins_summary, help='print registered plugin summaries')
    plugins_subparser.add_argument('--group',
                                   help='show plugins belonging to this group')
    plugins_subparser.add_argument('--phase',
                                   help='show plugins that act on this phase')
Ejemplo n.º 6
0
def register_parser_arguments():
    parser = options.register_command(
        'users',
        do_cli,
        help='Manage users providing access to the web server')
    subparsers = parser.add_subparsers(dest='action', metavar='<action>')

    subparsers.add_parser('list', help='List users')

    add_parser = subparsers.add_parser('add', help='add a new user')
    add_parser.add_argument('user', metavar='<username>', help='Users login')
    add_parser.add_argument('password',
                            metavar='<password>',
                            help='Users password')

    del_parser = subparsers.add_parser('delete', help='delete a new user')
    del_parser.add_argument('user',
                            metavar='<username>',
                            help='Login to delete')

    pwd_parser = subparsers.add_parser('passwd',
                                       help='change password for user')
    pwd_parser.add_argument('user',
                            metavar='<username>',
                            help='User to change password')
    pwd_parser.add_argument('password',
                            metavar='<new password>',
                            help='New Password')

    gentoken_parser = subparsers.add_parser(
        'gentoken', help='Generate a new api token for a user')
    gentoken_parser.add_argument('user',
                                 metavar='<username>',
                                 help='User to regenerate api token')
Ejemplo n.º 7
0
def register_parser_arguments():
    acc_text = 'local identifier which should be used in your config to refer these credentials'
    # Register subcommand
    parser = options.register_command('trakt', do_cli, help='view and manage trakt authentication.')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='action')
    auth_parser = subparsers.add_parser('auth', help='authorize Flexget to access your Trakt.tv account')

    auth_parser.add_argument('account', metavar='<account>', help=acc_text)
    auth_parser.add_argument('pin', metavar='<pin>', help='get this by authorizing FlexGet to use your trakt account '
                                                          'at %s' % PIN_URL, nargs='?')

    show_parser = subparsers.add_parser('show', help='show expiration date for Flexget authorization(s) (don\'t worry, '
                                                     'they will automatically refresh when expired)')

    show_parser.add_argument('account', metavar='<account>', nargs='?', help=acc_text)

    refresh_parser = subparsers.add_parser('refresh', help='manually refresh your access token associated with your'
                                                           ' --account <name>')

    refresh_parser.add_argument('account', metavar='<account>', help=acc_text)

    delete_parser = subparsers.add_parser('delete', help='delete the specified <account> name from local database')

    delete_parser.add_argument('account', metavar='<account>', help=acc_text)
Ejemplo n.º 8
0
def register_parser_arguments():
    parser = options.register_command('doc',
                                      print_doc,
                                      help='display plugin documentation')
    parser.add_argument('doc',
                        metavar='<plugin name>',
                        help='name of plugin to show docs for')
Ejemplo n.º 9
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    movie_parser = ArgumentParser(add_help=False)
    movie_parser.add_argument("movie_title", help="Title of the movie")

    identifiers_parser = ArgumentParser(add_help=False)
    identifiers_parser.add_argument(
        "-i",
        "--identifiers",
        metavar="<identifiers>",
        nargs="+",
        type=movie_list_keyword_type,
        help="Can be a string or a list of string with the format imdb_id=XXX," " tmdb_id=XXX, etc",
    )
    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument("list_name", nargs="?", default="movies", help="Name of movie list to operate on")
    # Register subcommand
    parser = options.register_command("movie-list", do_cli, help="View and manage movie lists")
    # Set up our subparsers
    subparsers = parser.add_subparsers(title="actions", metavar="<action>", dest="list_action")
    subparsers.add_parser("all", parents=[table_parser], help="Shows all existing movie lists")
    subparsers.add_parser("list", parents=[list_name_parser, table_parser], help="List movies from a list")
    subparsers.add_parser(
        "add", parents=[list_name_parser, movie_parser, identifiers_parser], help="Add a movie to a list"
    )
    subparsers.add_parser(
        "del", parents=[list_name_parser, movie_parser], help="Remove a movie from a list using its title"
    )
    subparsers.add_parser(
        "purge", parents=[list_name_parser], help="Removes an entire list with all of its movies. Use this with caution"
    )
Ejemplo n.º 10
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    entry_parser = ArgumentParser(add_help=False)
    entry_parser.add_argument('-t', '--entry_title', required=True, help="Title of the entry")
    entry_parser.add_argument('-u', '--original_url', required=True, help="URL of the entry")

    global_entry_parser = ArgumentParser(add_help=False)
    global_entry_parser.add_argument('entry', help='can be entry title or ID')

    identifiers_parser = ArgumentParser(add_help=False)
    identifiers_parser.add_argument('-i', '--identifiers', metavar='<identifiers>', nargs='+',
                                    help='Can be a string or a list of string with the format imdb_id=XXX,'
                                         ' tmdb_id=XXX, etc')
    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument('-l', '--list_name', metavar='<list_name>', required=True,
                                  help='name of entry list to operate on')
    # Register subcommand
    parser = options.register_command('entry-list', do_cli, help='view and manage entry lists')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='list_action')
    all_parser = subparsers.add_parser('all', help='shows all existing entry lists')
    list_parser = subparsers.add_parser('list', parents=[list_name_parser], help='list entries from a list')
    show_parser = subparsers.add_parser('show', parents=[list_name_parser, global_entry_parser],
                                        help='show entry fields.')

    add_parser = subparsers.add_parser('add', parents=[identifiers_parser, list_name_parser, entry_parser],
                                       help='add an entry to a list')
    subparsers.add_parser('del', parents=[global_entry_parser, list_name_parser],
                          help='remove an entry from a list using its title')
    subparsers.add_parser('purge', parents=[list_name_parser],
                          help='removes an entire list with all of its entries. Use this with caution')
Ejemplo n.º 11
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    entry_parser = ArgumentParser(add_help=False)
    entry_parser.add_argument('-t',
                              '--entry_title',
                              required=True,
                              help="Title of the entry")
    entry_parser.add_argument('-u',
                              '--original_url',
                              required=True,
                              help="URL of the entry")

    global_entry_parser = ArgumentParser(add_help=False)
    global_entry_parser.add_argument('entry', help='can be entry title or ID')

    identifiers_parser = ArgumentParser(add_help=False)
    identifiers_parser.add_argument(
        '-i',
        '--identifiers',
        metavar='<identifiers>',
        nargs='+',
        help='Can be a string or a list of string with the format imdb_id=XXX,'
        ' tmdb_id=XXX, etc')
    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument('-l',
                                  '--list_name',
                                  metavar='<list_name>',
                                  required=True,
                                  help='name of entry list to operate on')
    # Register subcommand
    parser = options.register_command('entry-list',
                                      do_cli,
                                      help='view and manage entry lists')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions',
                                       metavar='<action>',
                                       dest='list_action')
    all_parser = subparsers.add_parser('all',
                                       help='shows all existing entry lists')
    list_parser = subparsers.add_parser('list',
                                        parents=[list_name_parser],
                                        help='list entries from a list')
    show_parser = subparsers.add_parser(
        'show',
        parents=[list_name_parser, global_entry_parser],
        help='show entry fields.')

    add_parser = subparsers.add_parser(
        'add',
        parents=[identifiers_parser, list_name_parser, entry_parser],
        help='add an entry to a list')
    subparsers.add_parser('del',
                          parents=[global_entry_parser, list_name_parser],
                          help='remove an entry from a list using its title')
    subparsers.add_parser(
        'purge',
        parents=[list_name_parser],
        help=
        'removes an entire list with all of its entries. Use this with caution'
    )
Ejemplo n.º 12
0
def register_parser_arguments():
    acc_text = 'local identifier which should be used in your config to refer these credentials'
    # Register subcommand
    parser = options.register_command('trakt', do_cli, help='view and manage trakt authentication.'
                                                            'Please visit %s to retrieve your pin code.' % PIN_URL)
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='action')
    auth_parser = subparsers.add_parser('auth', help='authorize Flexget to access your Trakt.tv account')

    auth_parser.add_argument('account', metavar='<account>', help=acc_text)
    auth_parser.add_argument('pin', metavar='<pin>', help='get this by authorizing FlexGet to use your trakt account '
                                                          'at %s' % PIN_URL)

    show_parser = subparsers.add_parser('show', help='show expiration date for Flexget authorization(s) (don\'t worry, '
                                                     'they will automatically refresh when expired)')

    show_parser.add_argument('account', metavar='<account>', nargs='?', help=acc_text)

    refresh_parser = subparsers.add_parser('refresh', help='manually refresh your access token associated with your'
                                                           ' --account <name>')

    refresh_parser.add_argument('account', metavar='<account>', help=acc_text)

    delete_parser = subparsers.add_parser('delete', help='delete the specified <account> name from local database')

    delete_parser.add_argument('account', metavar='<account>', help=acc_text)
Ejemplo n.º 13
0
def register_parser_arguments():
    parser = options.register_command(
        'database', do_cli, help='utilities to manage the FlexGet database')
    subparsers = parser.add_subparsers(title='Actions',
                                       metavar='<action>',
                                       dest='db_action')
    subparsers.add_parser(
        'cleanup',
        help='make all plugins clean un-needed data from the database')
    subparsers.add_parser(
        'vacuum',
        help=
        'running vacuum can increase performance and decrease database size')
    reset_parser = subparsers.add_parser(
        'reset', add_help=False, help='reset the entire database (DANGEROUS!)')
    reset_parser.add_argument(
        '--sure',
        action='store_true',
        required=True,
        help='you must use this flag to indicate you REALLY want to do this')
    reset_plugin_parser = subparsers.add_parser(
        'reset-plugin', help='reset the database for a specific plugin')
    reset_plugin_parser.add_argument(
        'reset_plugin',
        metavar='<plugin>',
        nargs='?',
        help=
        'name of plugin to reset (if omitted, known plugins will be listed)')
Ejemplo n.º 14
0
def register_parser_arguments():
    # Register the command
    parser = options.register_command('series', do_cli, help='view and manipulate the series plugin database')

    # Parent parser for subcommands that need a series name
    series_parser = argparse.ArgumentParser(add_help=False)
    series_parser.add_argument('series_name', help='the name of the series', metavar='<series name>')

    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='series_action')
    list_parser = subparsers.add_parser('list', help='list a summary of the different series being tracked')
    list_parser.add_argument('configured', nargs='?', choices=['configured', 'unconfigured', 'all'],
                             default='configured',
                             help='limit list to series that are currently in the config or not (default: %(default)s)')
    list_parser.add_argument('--premieres', action='store_true',
                             help='limit list to series which only have episode 1 (and maybe also 2) downloaded')
    list_parser.add_argument('--new', nargs='?', type=int, metavar='DAYS', const=7,
                             help='limit list to series with a release seen in last %(const)s days. number of days can '
                                  'be overridden with %(metavar)s')
    list_parser.add_argument('--stale', nargs='?', type=int, metavar='DAYS', const=365,
                             help='limit list to series which have not seen a release in %(const)s days. number of '
                                  'days can be overridden with %(metavar)s')
    list_parser.add_argument('--porcelain', action='store_true', help='make the output parseable')
    show_parser = subparsers.add_parser('show', parents=[series_parser],
                                        help='show the releases FlexGet has seen for a given series ')
    begin_parser = subparsers.add_parser('begin', parents=[series_parser],
                                         help='set the episode to start getting a series from')
    begin_parser.add_argument('episode_id', metavar='<episode ID>',
                              help='episode ID to start getting the series from (e.g. S02E01, 2013-12-11, or 9, '
                                   'depending on how the series is numbered)')
    forget_parser = subparsers.add_parser('forget', parents=[series_parser],
                                          help='removes episodes or whole series from the series database')
    forget_parser.add_argument('episode_id', nargs='?', default=None, help='episode ID to forget (optional)')
Ejemplo n.º 15
0
def register_parser_arguments():
    parser = options.register_command(
        'history',
        do_cli,
        help='View the history of entries that FlexGet has accepted',
        parents=[table_parser],
    )
    parser.add_argument(
        '--limit',
        action='store',
        type=int,
        metavar='NUM',
        default=50,
        help='limit to %(metavar)s results',
    )
    parser.add_argument(
        '--search',
        action='store',
        metavar='TERM',
        help='Limit to results that contain %(metavar)s',
    )
    parser.add_argument(
        '--task', action='store', metavar='TASK', help='Limit to results in specified %(metavar)s'
    )
    parser.add_argument(
        '--short', '-s', action='store_true', dest='short', default=False, help='Shorter output'
    )
Ejemplo n.º 16
0
Archivo: cli.py Proyecto: ksurl/Flexget
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    movie_parser = ArgumentParser(add_help=False)
    movie_parser.add_argument('movie_title',
                              metavar='<MOVIE TITLE>',
                              help="Title of the movie")

    name_or_id_parser = ArgumentParser(add_help=False)
    name_or_id_parser.add_argument('movie',
                                   metavar='<NAME or ID>',
                                   help="Title or ID of the movie")

    identifiers_parser = ArgumentParser(add_help=False)
    identifiers_parser.add_argument(
        '-i',
        '--identifiers',
        metavar='<identifiers>',
        nargs='+',
        type=movie_list_keyword_type,
        help='Can be a string or a list of string with the format imdb_id=XXX,'
        ' tmdb_id=XXX, etc',
    )
    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument(
        'list_name',
        nargs='?',
        metavar='<LIST NAME>',
        default='movies',
        help='Name of movie list to operate on (Default is \'movies\')',
    )
    # Register subcommand
    parser = options.register_command('movie-list',
                                      do_cli,
                                      help='View and manage movie lists')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions',
                                       metavar='<action>',
                                       dest='list_action')
    subparsers.add_parser('all',
                          parents=[table_parser],
                          help='Shows all existing movie lists')
    subparsers.add_parser('list',
                          parents=[list_name_parser, table_parser],
                          help='List movies from a list')
    subparsers.add_parser(
        'add',
        parents=[list_name_parser, movie_parser, identifiers_parser],
        help='Add a movie to a list',
    )
    subparsers.add_parser(
        'del',
        parents=[list_name_parser, name_or_id_parser],
        help='Remove a movie from a list using its title or ID',
    )
    subparsers.add_parser(
        'purge',
        parents=[list_name_parser],
        help=
        'Removes an entire list with all of its movies. Use this with caution',
    )
Ejemplo n.º 17
0
def register_parser_arguments():
    # Register the command
    parser = options.register_command(
        't411',
        do_cli,
        help='view and manipulate the Torrent411 plugin database')

    # Set up our subparsers
    action_parsers = parser.add_subparsers(title='actions',
                                           metavar='<action>',
                                           dest='t411_action')
    auth_parser = action_parsers.add_parser(
        'add-auth', help='authorize Flexget to access your Torrent411 account')
    auth_parser.add_argument('username',
                             metavar='<username>',
                             help='Your t411 username')
    auth_parser.add_argument('password',
                             metavar='<password>',
                             help='Your t411 password')

    list_categories_parser = action_parsers.add_parser(
        'list-cats', help='list available categories on Torrent411')
    list_categories_parser.add_argument(
        'category',
        nargs='?',
        metavar='<category>',
        help='limit list to all, main or sub categories (default: %(default)s)'
    )

    list_terms = action_parsers.add_parser(
        'list-terms', help='list available terms usable on Torrent411')
    list_terms.add_argument('--category',
                            help='show terms only for this category')
    list_terms.add_argument('--type',
                            help='show terms only for this term type')
Ejemplo n.º 18
0
def register_parser_arguments():
    selection_parser = ArgumentParser(add_help=False)
    selection_parser.add_argument(
        'selection', type=valid_entry, help='Entity ID or \'all\' to approve all pending entries'
    )

    filter_parser = ArgumentParser(add_help=False)
    filter_parser.add_argument('--task-name', help='Filter by task name')

    parser = options.register_command('pending', do_cli, help='View and manage pending entries')
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='action')

    list_parser = subparsers.add_parser(
        'list', help='Shows all existing pending entries', parents=[table_parser, filter_parser]
    )

    list_group = list_parser.add_mutually_exclusive_group()
    list_group.add_argument(
        '--pending',
        action='store_false',
        help='Show only pending entries',
        dest='approved',
        default=None,
    )
    list_group.add_argument(
        '--approved',
        action='store_true',
        help='Show only approved entries',
        dest='approved',
        default=None,
    )

    subparsers.add_parser('approve', help='Approve pending entries', parents=[selection_parser])
    subparsers.add_parser('reject', help='Reject pending entries', parents=[selection_parser])
    subparsers.add_parser('clear', help='Clear all pending entries', parents=[filter_parser])
Ejemplo n.º 19
0
def register_parser_arguments():
    parser = options.register_command(_PLUGIN_NAME, do_cli, help='{0} cli'.format(_PLUGIN_NAME))
    """:type: options.CoreArgumentParser"""
    subp = parser.add_subparsers(dest='action')
    bsp = subp.add_parser('bootstrap', help='bootstrap the plugin according to config')
    bsp.add_argument('--tasks', )
    subp.add_parser('test-msg', help='send test message to all configured recipients')
Ejemplo n.º 20
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    entry_parser = ArgumentParser(add_help=False)
    entry_parser.add_argument('entry_title', help="Title of the entry")
    entry_parser.add_argument('url', help="URL of the entry")

    global_entry_parser = ArgumentParser(add_help=False)
    global_entry_parser.add_argument('entry', help='Can be entry title or ID')

    attributes_parser = ArgumentParser(add_help=False)
    attributes_parser.add_argument('--attributes', metavar='<attributes>', nargs='+', type=attribute_type,
                                   help='Can be a string or a list of string with the format imdb_id=XXX,'
                                        ' tmdb_id=XXX, etc')
    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument('list_name', nargs='?', default='pending', help='Name of pending list to operate on')
    # Register subcommand
    parser = options.register_command('pending-list', do_cli, help='View and manage pending lists')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='list_action')
    subparsers.add_parser('all', help='Shows all existing pending lists', parents=[table_parser])
    subparsers.add_parser('list', parents=[list_name_parser, table_parser],
                          help='List pending entries from a pending list')
    subparsers.add_parser('show', parents=[list_name_parser, global_entry_parser, table_parser],
                          help='Show entry fields.')
    add = subparsers.add_parser('add', parents=[list_name_parser, entry_parser, attributes_parser],
                                help='Add a entry to a pending list')
    add.add_argument('--approved', action='store_true', help='Add an entry as approved')
    subparsers.add_parser('approve', parents=[list_name_parser, global_entry_parser],
                          help="Mark a pending entry as approved")
    subparsers.add_parser('reject', parents=[list_name_parser, global_entry_parser],
                          help="Mark a pending entry as rejected")
    subparsers.add_parser('del', parents=[list_name_parser, global_entry_parser],
                          help='Remove an entry from a pending list using its title or ID')
    subparsers.add_parser('purge', parents=[list_name_parser],
                          help='Removes an entire pending list with all of its entries. Use this with caution')
Ejemplo n.º 21
0
def register_parser_arguments():
    exec_parser = options.get_parser('execute')
    inject_parser = options.register_command(
        'inject',
        do_cli,
        add_help=False,
        parents=[exec_parser],
        help='inject an entry from command line into tasks',
        usage='%(prog)s title/url [url] [--accept] [--force] '
        '[--fields NAME=VALUE [NAME=VALUE...]] [<execute arguments>]',
        epilog=(
            'If only a URL and no title is given, Flexget will attempt to '
            'find a title in the URL\'s response headers.'
        ),
    )
    inject_group = inject_parser.add_argument_group('inject arguments')
    inject_group.add_argument(
        'title', metavar='title/url', help='title or url of the entry to inject'
    )
    inject_group.add_argument('url', nargs='?', help='url of the entry to inject')
    inject_group.add_argument(
        '--force', action='store_true', help='prevent any plugins from rejecting this entry'
    )
    inject_group.add_argument(
        '--accept', action='store_true', help='accept this entry immediately upon injection'
    )
    inject_group.add_argument('--fields', metavar='NAME=VALUE', nargs='+', type=key_equals_value)
    # Hack the title of the exec options a bit (would be 'optional arguments' otherwise)
    inject_parser._action_groups[1].title = 'execute arguments'
    # The exec arguments show first... unless we switch them
    inject_parser._action_groups.remove(inject_group)
    inject_parser._action_groups.insert(0, inject_group)
Ejemplo n.º 22
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    regexp_parser = ArgumentParser(add_help=False)
    regexp_parser.add_argument('regexp', type=regexp_type, help="The regexp")

    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument(
        'list_name', nargs='?', help='Name of regexp list to operate on', default='regexps'
    )
    # Register subcommand
    parser = options.register_command('regexp-list', do_cli, help='View and manage regexp lists')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='regexp_action')
    subparsers.add_parser('all', parents=[table_parser], help='Shows all existing regexp lists')
    subparsers.add_parser(
        'list', parents=[list_name_parser, table_parser], help='List regexp from a list'
    )
    subparsers.add_parser(
        'add', parents=[list_name_parser, regexp_parser], help='Add a regexp to a list'
    )
    subparsers.add_parser(
        'del', parents=[list_name_parser, regexp_parser], help='Remove a regexp from a list'
    )
    subparsers.add_parser(
        'purge', parents=[list_name_parser], help='Removes an entire list. Use with caution!'
    )
Ejemplo n.º 23
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    movie_parser = ArgumentParser(add_help=False)
    movie_parser.add_argument('movie_title', metavar='<MOVIE TITLE>', help="Title of the movie")

    name_or_id_parser = ArgumentParser(add_help=False)
    name_or_id_parser.add_argument('movie', metavar='<NAME or ID>', help="Title or ID of the movie")

    identifiers_parser = ArgumentParser(add_help=False)
    identifiers_parser.add_argument('-i', '--identifiers', metavar='<identifiers>', nargs='+',
                                    type=movie_list_keyword_type,
                                    help='Can be a string or a list of string with the format imdb_id=XXX,'
                                         ' tmdb_id=XXX, etc')
    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument('list_name', nargs='?', metavar='<LIST NAME>', default='movies',
                                  help='Name of movie list to operate on (Default is \'movies\')')
    # Register subcommand
    parser = options.register_command('movie-list', do_cli, help='View and manage movie lists')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='list_action')
    subparsers.add_parser('all', parents=[table_parser], help='Shows all existing movie lists')
    subparsers.add_parser('list', parents=[list_name_parser, table_parser], help='List movies from a list')
    subparsers.add_parser('add', parents=[list_name_parser, movie_parser, identifiers_parser],
                          help='Add a movie to a list')
    subparsers.add_parser('del', parents=[list_name_parser, name_or_id_parser],
                          help='Remove a movie from a list using its title or ID')
    subparsers.add_parser('purge', parents=[list_name_parser],
                          help='Removes an entire list with all of its movies. Use this with caution')
Ejemplo n.º 24
0
def register_parser_arguments():
    parser = options.register_command(
        'history',
        do_cli,
        help='View the history of entries that FlexGet has accepted',
        parents=[table_parser])
    parser.add_argument('--limit',
                        action='store',
                        type=int,
                        metavar='NUM',
                        default=50,
                        help='limit to %(metavar)s results')
    parser.add_argument('--search',
                        action='store',
                        metavar='TERM',
                        help='Limit to results that contain %(metavar)s')
    parser.add_argument('--task',
                        action='store',
                        metavar='TASK',
                        help='Limit to results in specified %(metavar)s')
    parser.add_argument('--short',
                        '-s',
                        action='store_true',
                        dest='short',
                        default=False,
                        help='Shorter output')
Ejemplo n.º 25
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    entry_parser = ArgumentParser(add_help=False)
    entry_parser.add_argument('entry_title', help="Title of the entry")
    entry_parser.add_argument('url', help="URL of the entry")

    global_entry_parser = ArgumentParser(add_help=False)
    global_entry_parser.add_argument('entry', help='Can be entry title or ID')

    attributes_parser = ArgumentParser(add_help=False)
    attributes_parser.add_argument('--attributes', metavar='<attributes>', nargs='+', type=attribute_type,
                                   help='Can be a string or a list of string with the format imdb_id=XXX,'
                                        ' tmdb_id=XXX, etc')
    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument('list_name', nargs='?', default='pending', help='Name of pending list to operate on')
    # Register subcommand
    parser = options.register_command('pending-list', do_cli, help='View and manage pending lists')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='list_action')
    subparsers.add_parser('all', help='Shows all existing pending lists', parents=[table_parser])
    subparsers.add_parser('list', parents=[list_name_parser, table_parser],
                          help='List pending entries from a pending list')
    subparsers.add_parser('show', parents=[list_name_parser, global_entry_parser, table_parser],
                          help='Show entry fields.')
    add = subparsers.add_parser('add', parents=[list_name_parser, entry_parser, attributes_parser],
                                help='Add a entry to a pending list')
    add.add_argument('--approved', action='store_true', help='Add an entry as approved')
    subparsers.add_parser('approve', parents=[list_name_parser, global_entry_parser],
                          help="Mark a pending entry as approved")
    subparsers.add_parser('reject', parents=[list_name_parser, global_entry_parser],
                          help="Mark a pending entry as rejected")
    subparsers.add_parser('del', parents=[list_name_parser, global_entry_parser],
                          help='Remove an entry from a pending list using its title or ID')
    subparsers.add_parser('purge', parents=[list_name_parser],
                          help='Removes an entire pending list with all of its entries. Use this with caution')
Ejemplo n.º 26
0
def register_parser_arguments():
    plugins_parser = ArgumentParser(add_help=False)
    plugins_parser.add_argument('plugin_name',
                                help="Name of plugin to reset",
                                nargs=1,
                                choices=list(plugin_schemas))

    parser = options.register_command(
        'database', do_cli, help='Utilities to manage the FlexGet database')
    subparsers = parser.add_subparsers(title='Actions',
                                       metavar='<action>',
                                       dest='db_action')
    subparsers.add_parser(
        'cleanup',
        help='Make all plugins clean un-needed data from the database')
    subparsers.add_parser(
        'vacuum',
        help=
        'Running vacuum can increase performance and decrease database size')
    reset_parser = subparsers.add_parser(
        'reset', add_help=False, help='Reset the entire database (DANGEROUS!)')
    reset_parser.add_argument(
        '--sure',
        action='store_true',
        required=True,
        help='You must use this flag to indicate you REALLY want to do this')
    subparsers.add_parser('reset-plugin',
                          help='Reset the database for a specific plugin',
                          parents=[plugins_parser])
Ejemplo n.º 27
0
def register_parser_arguments():
    parser = options.register_command('failed', do_cli, help='list or clear remembered failures')
    subparsers = parser.add_subparsers(dest='failed_action', metavar='<action>')
    subparsers.add_parser(
        'list', help='list all the entries that have had failures', parents=[table_parser]
    )
    subparsers.add_parser('clear', help='clear all failures from database, so they can be retried')
Ejemplo n.º 28
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    regexp_parser = ArgumentParser(add_help=False)
    regexp_parser.add_argument('regexp', type=regexp_type, help="The regexp")

    list_name_parser = ArgumentParser(add_help=False)
    list_name_parser.add_argument('list_name',
                                  nargs='?',
                                  help='Name of regexp list to operate on',
                                  default='regexps')
    # Register subcommand
    parser = options.register_command('regexp-list',
                                      do_cli,
                                      help='View and manage regexp lists')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions',
                                       metavar='<action>',
                                       dest='regexp_action')
    subparsers.add_parser('all',
                          parents=[table_parser],
                          help='Shows all existing regexp lists')
    subparsers.add_parser('list',
                          parents=[list_name_parser, table_parser],
                          help='List regexp from a list')
    subparsers.add_parser('add',
                          parents=[list_name_parser, regexp_parser],
                          help='Add a regexp to a list')
    subparsers.add_parser('del',
                          parents=[list_name_parser, regexp_parser],
                          help='Remove a regexp from a list')
    subparsers.add_parser('purge',
                          parents=[list_name_parser],
                          help='Removes an entire list. Use with caution!')
Ejemplo n.º 29
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    irc_parser = ArgumentParser(add_help=False)
    irc_parser.add_argument('irc_connection',
                            nargs='?',
                            help="Title of the irc connection")

    # Register subcommand
    parser = options.register_command('irc',
                                      do_cli,
                                      help='View and manage irc connections')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions',
                                       metavar='<action>',
                                       dest='irc_action')
    subparsers.add_parser(
        'status',
        parents=[irc_parser, table_parser],
        help='Shows status for specific irc connection',
    )
    subparsers.add_parser('restart',
                          parents=[irc_parser],
                          help='Restart an irc connection')
    subparsers.add_parser('stop',
                          parents=[irc_parser],
                          help='Stops an irc connection')
Ejemplo n.º 30
0
def register_parser_arguments():
    archive_parser = options.register_command(
        'archive', do_cli, help='Search and manipulate the archive database')
    archive_parser.add_subparsers(title='Actions',
                                  metavar='<action>',
                                  dest='archive_action')
    # Default usage shows the positional arguments after the optional ones, override usage to fix it
    search_parser = archive_parser.add_subparser(
        'search',
        help='Search from the archive',
        usage='%(prog)s [-h] <keyword> [<keyword> ...] [optional arguments]',
        parents=[table_parser],
    )
    search_parser.add_argument('keywords',
                               metavar='<keyword>',
                               nargs='+',
                               help='Keyword(s) to search for')
    search_parser.add_argument('--tags',
                               metavar='TAG',
                               nargs='+',
                               default=[],
                               help='Tag(s) to search within')
    search_parser.add_argument('--sources',
                               metavar='SOURCE',
                               nargs='+',
                               default=[],
                               help='Source(s) to search within')
    inject_parser = archive_parser.add_subparser(
        'inject', help='Inject entries from the archive back into tasks')
    inject_parser.add_argument('ids',
                               nargs='+',
                               type=int,
                               metavar='ID',
                               help='Archive ID of an item to inject')
    inject_parser.add_argument(
        '--immortal',
        action='store_true',
        help='Injected entries will not be able to be '
        'rejected by any plugins',
    )
    exec_group = inject_parser.add_argument_group('execute arguments')
    exec_group.add_argument('execute_options',
                            action=ParseExtrasAction,
                            parser=get_parser('execute'))
    tag_parser = archive_parser.add_subparser(
        'tag-source', help='Tag all archived entries within a given source')
    tag_parser.add_argument(
        'source',
        metavar='<source>',
        help='The source whose entries you would like to tag')
    tag_parser.add_argument(
        'tags',
        nargs='+',
        metavar='<tag>',
        help='The tag(s) you would like to apply to the entries',
    )
    archive_parser.add_subparser(
        'consolidate',
        help='Migrate old archive data to new model, may take a long time')
Ejemplo n.º 31
0
def register_parser_arguments():
    if not sys.platform.startswith('win'):
        return
    # Still not fully working. Hidden for now.
    parser = options.register_command('service', do_cli,  # help='set up or control a windows service for the daemon',
                                      add_help=False)
    parser.add_argument('--help', '-h', action='store_true')
    parser.add_argument('args', nargs=argparse.REMAINDER)
Ejemplo n.º 32
0
def register_parser_arguments():
    parser = options.register_command(
        'templates',
        list_file_templates,
        help='View all available templates',
        parents=[table_parser],
    )
    parser.add_argument('--name', help='Filter results by template name')
Ejemplo n.º 33
0
def register_parser_arguments():
    parser = options.register_command(
        'templates',
        list_file_templates,
        help='View all available templates',
        parents=[table_parser],
    )
    parser.add_argument('--name', help='Filter results by template name')
Ejemplo n.º 34
0
def register_options():
    parser = options.register_command(
        "backlog", do_cli, help="View or clear entries from backlog plugin", parents=[table_parser]
    )
    parser.add_argument(
        "action", choices=["list", "clear"], help="Choose to show items in backlog, or clear all of them"
    )
    parser.add_argument("task", nargs="?", help="Limit to specific task (if supplied)")
Ejemplo n.º 35
0
def register_parser_arguments():
    if not sys.platform.startswith('win'):
        return
    # Still not fully working. Hidden for now.
    parser = options.register_command('service', do_cli,  #help='set up or control a windows service for the daemon',
                                      add_help=False)
    parser.add_argument('--help', '-h', action='store_true')
    parser.add_argument('args', nargs=argparse.REMAINDER)
Ejemplo n.º 36
0
def register_parser_arguments():
    # Register subcommand
    parser = options.register_command(
        'jinja-filters',
        do_cli,
        help='View registered jinja2 filters and their description',
        parents=[table_parser])
    parser.add_argument('--name', help='Filter results by filter name')
Ejemplo n.º 37
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    what_parser = ArgumentParser(add_help=False)
    what_parser.add_argument(
        'movie_name',
        metavar='<movie>',
        help=
        'the movie (can be movie title, imdb id, or in the form `tmdb_id=XXXX`'
    )
    name_parser = ArgumentParser(add_help=False)
    name_parser.add_argument(
        '--queue_name',
        default='default',
        metavar='<queue_name>',
        help=
        'name of movie queue to operate on. optional, leave empty for default')
    # Register subcommand
    parser = options.register_command('movie-queue',
                                      do_cli,
                                      help='view and manage the movie queue')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions',
                                       metavar='<action>',
                                       dest='queue_action')
    list_parser = subparsers.add_parser('list',
                                        parents=[name_parser],
                                        help='list movies from the queue')
    list_parser.add_argument(
        'type',
        nargs='?',
        choices=['waiting', 'downloaded', 'all'],
        default='waiting',
        help='choose to show waiting or already downloaded movies')
    list_parser.add_argument('--porcelain',
                             action='store_true',
                             help='make the output parseable')
    add_parser = subparsers.add_parser('add',
                                       parents=[what_parser, name_parser],
                                       help='add a movie to the queue')
    add_parser.add_argument(
        'quality',
        metavar='<quality>',
        default='ANY',
        nargs='?',
        help=
        'the quality requirements for getting this movie (default: %(default)s)'
    )
    subparsers.add_parser('del',
                          parents=[what_parser, name_parser],
                          help='remove a movie from the queue')
    subparsers.add_parser('forget',
                          parents=[what_parser, name_parser],
                          help='remove the downloaded flag from a movie')
    subparsers.add_parser(
        'clear',
        parents=[name_parser],
        help='remove all un-downloaded movies from the queue')
Ejemplo n.º 38
0
def register_options():
    parser = options.register_command(
        'backlog', do_cli, help='view or clear entries from backlog plugin')
    parser.add_argument('action',
                        choices=['list', 'clear'],
                        help='choose to show items in backlog, or clear them')
    parser.add_argument('task',
                        nargs='?',
                        help='limit to specific task (if supplied)')
Ejemplo n.º 39
0
def register_parser_arguments():
    parser = options.register_command('web', do_cli, help='Manage web server settings')
    subparsers = parser.add_subparsers(dest='action', metavar='<action>')

    pwd_parser = subparsers.add_parser('passwd', help='change password for web server')
    pwd_parser.add_argument('password', metavar='<new password>', help='New Password')

    subparsers.add_parser('gentoken', help='Generate a new api token')
    subparsers.add_parser('showtoken', help='Show api token')
Ejemplo n.º 40
0
def register_parser_arguments():
    parser = options.register_command('web', do_cli, help='Manage web server settings')
    subparsers = parser.add_subparsers(dest='action', metavar='<action>')

    pwd_parser = subparsers.add_parser('passwd', help='change password for web server')
    pwd_parser.add_argument('password', metavar='<new password>', help='New Password')

    subparsers.add_parser('gentoken', help='Generate a new api token')
    subparsers.add_parser('showtoken', help='Show api token')
Ejemplo n.º 41
0
def register_parser_arguments():
    if not sys.platform.startswith("win"):
        return
    # Still not fully working. Hidden for now.
    parser = options.register_command(
        "service", do_cli, add_help=False  # help='set up or control a windows service for the daemon',
    )
    parser.add_argument("--help", "-h", action="store_true")
    parser.add_argument("args", nargs=argparse.REMAINDER)
Ejemplo n.º 42
0
def register_parser_arguments():
    parser = options.register_command('seen', do_cli, help='view or forget entries remembered by the seen plugin')
    subparsers = parser.add_subparsers(dest='seen_action', metavar='<action>')
    forget_parser = subparsers.add_parser('forget', help='forget entry or entire task from seen plugin database')
    forget_parser.add_argument('forget_value', metavar='<value>',
                               help='title or url of entry to forget, or name of task to forget')
    add_parser = subparsers.add_parser('add', help='add a title or url to the seen database')
    add_parser.add_argument('add_value', metavar='<value>', help='the title or url to add')
    search_parser = subparsers.add_parser('search', help='search text from the seen database')
    search_parser.add_argument('search_term', metavar='<search term>')
Ejemplo n.º 43
0
def register_parser_arguments():
    parser = options.register_command('plugins',
                                      plugins_summary,
                                      help='Print registered plugin summaries',
                                      parents=[table_parser])
    parser.add_argument('--group', help='Show plugins belonging to this group')
    parser.add_argument('--phase', help='Show plugins that act on this phase')
    parser.add_argument('--builtins',
                        action='store_true',
                        help='Show just builtin plugins')
Ejemplo n.º 44
0
def register_parser_arguments():
    parser = options.register_command('users', do_cli, help='Manage users providing access to the web server')
    subparsers = parser.add_subparsers(dest='action', metavar='<action>')

    pwd_parser = subparsers.add_parser('passwd', help='change password for user')
    pwd_parser.add_argument('user', metavar='<username>', help='User to change password')
    pwd_parser.add_argument('password', metavar='<new password>', help='New Password')

    gentoken_parser = subparsers.add_parser('gentoken', help='Generate a new api token for a user')
    gentoken_parser.add_argument('user', metavar='<username>', help='User to regenerate api token')
Ejemplo n.º 45
0
def register_parser_arguments():
    plugins_subparser = options.register_command(
        'plugins', plugins_summary, help='print registered plugin summaries')
    plugins_subparser.add_argument('--group',
                                   help='show plugins belonging to this group')
    plugins_subparser.add_argument('--phase',
                                   help='show plugins that act on this phase')
    plugins_subparser.add_argument('--porcelain',
                                   action='store_true',
                                   help='make the output parseable')
Ejemplo n.º 46
0
def register_parser_arguments():
    parser = options.register_command('seen', do_cli, help='View or forget entries remembered by the seen plugin')
    subparsers = parser.add_subparsers(dest='seen_action', metavar='<action>')
    forget_parser = subparsers.add_parser('forget', help='Forget entry or entire task from seen plugin database')
    forget_parser.add_argument('forget_value', metavar='<value>',
                               help='Title or url of entry to forget, or name of task to forget')
    add_parser = subparsers.add_parser('add', help='Add a title or url to the seen database')
    add_parser.add_argument('add_value', metavar='<value>', help='the title or url to add')
    search_parser = subparsers.add_parser('search', help='Search text from the seen database', parents=[table_parser])
    search_parser.add_argument('search_term', metavar='<search term>')
Ejemplo n.º 47
0
def register_parser_arguments():
    parser = options.register_command("seen", do_cli, help="view or forget entries remembered by the seen plugin")
    subparsers = parser.add_subparsers(dest="seen_action", metavar="<action>")
    forget_parser = subparsers.add_parser("forget", help="forget entry or entire task from seen plugin database")
    forget_parser.add_argument(
        "forget_value", metavar="<value>", help="title or url of entry to forget, or name of task to forget"
    )
    add_parser = subparsers.add_parser("add", help="add a title or url to the seen database")
    add_parser.add_argument("add_value", metavar="<value>", help="the title or url to add")
    search_parser = subparsers.add_parser("search", help="search text from the seen database")
    search_parser.add_argument("search_term", metavar="<search term>")
Ejemplo n.º 48
0
def register_parser_arguments():
    parser = options.register_command(
        'rejected', do_cli, help='list or clear remembered rejections'
    )
    subparsers = parser.add_subparsers(dest='rejected_action', metavar='<action>')
    subparsers.add_parser(
        'list', help='list all the entries that have been rejected', parents=[table_parser]
    )
    subparsers.add_parser(
        'clear', help='clear all rejected entries from database, so they can be retried'
    )
Ejemplo n.º 49
0
def register_parser_arguments():
    parser = options.register_command('failed',
                                      do_cli,
                                      help='list or clear remembered failures')
    subparsers = parser.add_subparsers(dest='failed_action',
                                       metavar='<action>')
    subparsers.add_parser('list',
                          help='list all the entries that have had failures')
    subparsers.add_parser(
        'clear',
        help='clear all failures from database, so they can be retried')
Ejemplo n.º 50
0
def register_parser_arguments():
    parser = options.register_command('database', do_cli, help='utilities to manage the FlexGet database')
    subparsers = parser.add_subparsers(title='Actions', metavar='<action>', dest='db_action')
    subparsers.add_parser('cleanup', help='make all plugins clean un-needed data from the database')
    subparsers.add_parser('vacuum', help='running vacuum can increase performance and decrease database size')
    reset_parser = subparsers.add_parser('reset', add_help=False, help='reset the entire database (DANGEROUS!)')
    reset_parser.add_argument('--sure', action='store_true', required=True,
                              help='you must use this flag to indicate you REALLY want to do this')
    reset_plugin_parser = subparsers.add_parser('reset-plugin', help='reset the database for a specific plugin')
    reset_plugin_parser.add_argument('reset_plugin', metavar='<plugin>', nargs='?',
                                 help='name of plugin to reset (if omitted, known plugins will be listed)')
Ejemplo n.º 51
0
def register_parser_arguments():
    parser = options.register_command(_PLUGIN_NAME,
                                      do_cli,
                                      help='{0} cli'.format(_PLUGIN_NAME))
    """:type: options.CoreArgumentParser"""
    subp = parser.add_subparsers(dest='action')
    bsp = subp.add_parser('bootstrap',
                          help='bootstrap the plugin according to config')
    bsp.add_argument('--tasks', )
    subp.add_parser('test-msg',
                    help='send test message to all configured recipients')
Ejemplo n.º 52
0
def register_parser_arguments():
    archive_parser = options.register_command(
        'archive', do_cli, help='Search and manipulate the archive database'
    )
    archive_parser.add_subparsers(title='Actions', metavar='<action>', dest='archive_action')
    # Default usage shows the positional arguments after the optional ones, override usage to fix it
    search_parser = archive_parser.add_subparser(
        'search',
        help='Search from the archive',
        usage='%(prog)s [-h] <keyword> [<keyword> ...] [optional arguments]',
        parents=[table_parser],
    )
    search_parser.add_argument(
        'keywords', metavar='<keyword>', nargs='+', help='Keyword(s) to search for'
    )
    search_parser.add_argument(
        '--tags', metavar='TAG', nargs='+', default=[], help='Tag(s) to search within'
    )
    search_parser.add_argument(
        '--sources', metavar='SOURCE', nargs='+', default=[], help='Source(s) to search within'
    )
    inject_parser = archive_parser.add_subparser(
        'inject', help='Inject entries from the archive back into tasks'
    )
    inject_parser.add_argument(
        'ids', nargs='+', type=int, metavar='ID', help='Archive ID of an item to inject'
    )
    inject_parser.add_argument(
        '--immortal',
        action='store_true',
        help='Injected entries will not be able to be ' 'rejected by any plugins',
    )
    exec_group = inject_parser.add_argument_group('execute arguments')
    exec_group.add_argument(
        'execute_options', action=ParseExtrasAction, parser=get_parser('execute')
    )
    tag_parser = archive_parser.add_subparser(
        'tag-source', help='Tag all archived entries within a given source'
    )
    tag_parser.add_argument(
        'source', metavar='<source>', help='The source whose entries you would like to tag'
    )
    tag_parser.add_argument(
        'tags',
        nargs='+',
        metavar='<tag>',
        help='The tag(s) you would like to apply to the entries',
    )
    archive_parser.add_subparser(
        'consolidate', help='Migrate old archive data to new model, may take a long time'
    )
Ejemplo n.º 53
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    irc_parser = ArgumentParser(add_help=False)
    irc_parser.add_argument('irc_connection', nargs='?', help="Title of the irc connection")

    # Register subcommand
    parser = options.register_command('irc', do_cli, help='View and manage irc connections')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='irc_action')
    subparsers.add_parser('status', parents=[irc_parser, table_parser], help='Shows status for specific irc connection')
    subparsers.add_parser('restart', parents=[irc_parser],
                          help='Restart an irc connection')
    subparsers.add_parser('stop', parents=[irc_parser],
                          help='Stops an irc connection')
Ejemplo n.º 54
0
def register_parser_arguments():
    parser = options.register_command(
        'status', do_cli, help='View task health status', parents=[table_parser]
    )
    parser.add_argument(
        '--task', action='store', metavar='TASK', help='Limit to results in specified %(metavar)s'
    )
    parser.add_argument(
        '--limit',
        action='store',
        type=int,
        metavar='NUM',
        default=50,
        help='Limit to %(metavar)s results',
    )
Ejemplo n.º 55
0
def register_parser_arguments():
    parser = options.register_command(
        'status', do_cli, help='View task health status', parents=[table_parser]
    )
    parser.add_argument(
        '--task', action='store', metavar='TASK', help='Limit to results in specified %(metavar)s'
    )
    parser.add_argument(
        '--limit',
        action='store',
        type=int,
        metavar='NUM',
        default=50,
        help='Limit to %(metavar)s results',
    )
Ejemplo n.º 56
0
def register_parser_arguments():
    parser = options.register_command(
        'history',
        do_cli,
        help='view the history of entries that FlexGet has accepted')
    parser.add_argument('--limit',
                        action='store',
                        type=int,
                        metavar='NUM',
                        default=50,
                        help='limit to %(metavar)s results')
    parser.add_argument('--search',
                        action='store',
                        metavar='TERM',
                        help='limit to results that contain %(metavar)s')
Ejemplo n.º 57
0
def register_parser_arguments():
    plugins_parser = ArgumentParser(add_help=False)
    plugins_parser.add_argument("plugin_name", help="Name of plugin to reset", nargs=1, choices=list(plugin_schemas))

    parser = options.register_command("database", do_cli, help="Utilities to manage the FlexGet database")
    subparsers = parser.add_subparsers(title="Actions", metavar="<action>", dest="db_action")
    subparsers.add_parser("cleanup", help="Make all plugins clean un-needed data from the database")
    subparsers.add_parser("vacuum", help="Running vacuum can increase performance and decrease database size")
    reset_parser = subparsers.add_parser("reset", add_help=False, help="Reset the entire database (DANGEROUS!)")
    reset_parser.add_argument(
        "--sure",
        action="store_true",
        required=True,
        help="You must use this flag to indicate you REALLY want to do this",
    )
    subparsers.add_parser("reset-plugin", help="Reset the database for a specific plugin", parents=[plugins_parser])
Ejemplo n.º 58
0
def register_parser_arguments():
    # Common option to be used in multiple subparsers
    what_parser = ArgumentParser(add_help=False)
    what_parser.add_argument('movie_name', metavar='<movie>',
                             help='the movie (can be movie title, imdb id, or in the form `tmdb_id=XXXX`')
    # Register subcommand
    parser = options.register_command('movie-queue', do_cli, help='view and manage the movie queue')
    # Set up our subparsers
    subparsers = parser.add_subparsers(title='actions', metavar='<action>', dest='queue_action')
    list_parser = subparsers.add_parser('list', help='list movies from the queue')
    list_parser.add_argument('type', nargs='?', choices=['waiting', 'downloaded'], default='waiting',
                             help='choose to show waiting or already downloaded movies')
    add_parser = subparsers.add_parser('add', parents=[what_parser], help='add a movie to the queue')
    add_parser.add_argument('quality', metavar='<quality>', default='ANY', nargs='?',
                            help='the quality requirements for getting this movie (default: %(default)s)')
    subparsers.add_parser('del', parents=[what_parser], help='remove a movie from the queue')
    subparsers.add_parser('forget', parents=[what_parser], help='remove the downloaded flag from a movie')
    subparsers.add_parser('clear', help='remove all un-downloaded movies from the queue')
Ejemplo n.º 59
0
def register_parser_arguments():
    # Register the command
    parser = options.register_command('t411', do_cli, help='view and manipulate the Torrent411 plugin database')

    # Set up our subparsers
    action_parsers = parser.add_subparsers(title='actions', metavar='<action>', dest='t411_action')
    auth_parser = action_parsers.add_parser('add-auth', help='authorize Flexget to access your Torrent411 account')
    auth_parser.add_argument('username', metavar='<username>', help='Your t411 username')
    auth_parser.add_argument('password', metavar='<password>', help='Your t411 password')

    list_categories_parser = action_parsers.add_parser('list-cats', help='list available categories on Torrent411')
    list_categories_parser.add_argument('category',
                                        nargs='?',
                                        metavar='<category>',
                                        help='limit list to all, main or sub categories (default: %(default)s)')

    list_terms = action_parsers.add_parser('list-terms', help='list available terms usable on Torrent411')
    list_terms.add_argument('--category', help='show terms only for this category')
    list_terms.add_argument('--type', help='show terms only for this term type')
Ejemplo n.º 60
0
def register_parser_arguments():
    # Register the command
    parser = options.register_command("t411", do_cli, help="view and manipulate the Torrent411 plugin database")

    # Set up our subparsers
    action_parsers = parser.add_subparsers(title="actions", metavar="<action>", dest="t411_action")
    auth_parser = action_parsers.add_parser("add-auth", help="authorize Flexget to access your Torrent411 account")
    auth_parser.add_argument("username", metavar="<username>", help="Your t411 username")
    auth_parser.add_argument("password", metavar="<password>", help="Your t411 password")

    list_categories_parser = action_parsers.add_parser("list-cats", help="list available categories on Torrent411")
    list_categories_parser.add_argument(
        "category",
        nargs="?",
        metavar="<category>",
        help="limit list to all, main or sub categories (default: %(default)s)",
    )

    list_terms = action_parsers.add_parser("list-terms", help="list available terms usable on Torrent411")
    list_terms.add_argument("--category", help="show terms only for this category")
    list_terms.add_argument("--type", help="show terms only for this term type")