How to use the flexget.terminal.console function in FlexGet

To help you get started, we’ve selected a few FlexGet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Flexget / Flexget / flexget / components / seen / cli.py View on Github external
def seen_add(options):
    seen_name = options.add_value
    if is_imdb_url(seen_name):
        console('IMDB url detected, try to parse ID')
        imdb_id = extract_id(seen_name)
        if imdb_id:
            seen_name = imdb_id
        else:
            console("Could not parse IMDB ID")
    db.add(seen_name, 'cli_add', {'cli_add': seen_name})
    console('Added %s as seen. This will affect all tasks.' % seen_name)
github Flexget / Flexget / flexget / components / managed_lists / lists / pending_list / cli.py View on Github external
def pending_list_purge(options):
    with Session() as session:
        try:
            entry_list = db.get_list_by_exact_name(options.list_name)
        except NoResultFound:
            console('Could not find entry list with name `{}`'.format(options.list_name))
            return
        console('Deleting list {}'.format(options.list_name))
        session.delete(entry_list)
github Flexget / Flexget / flexget / components / pending_approval / cli.py View on Github external
for entry in entries:
            table_data.append(
                [
                    entry.id,
                    entry.task_name,
                    entry.title,
                    entry.url,
                    colorize('green', 'Yes') if entry.approved else 'No',
                    entry.added.strftime("%c"),
                ]
            )
    try:
        table = TerminalTable(
            options.table_type, table_data, wrap_columns=[1, 2, 3], drop_columns=[5, 1, 3]
        )
        console(table.output)
    except TerminalTableError as e:
        console('ERROR: %s' % str(e))
github Flexget / Flexget / flexget / plugins / cli / plugins.py View on Github external
handlers = plugin.phase_handlers
        roles = []
        for phase in handlers:
            priority = handlers[phase].priority
            roles.append('{0}({1})'.format(phase, priority))

        name = colorize('green', plugin.name) if 'builtin' in flags else plugin.name
        table_data.append([name, ', '.join(plugin.interfaces), ', '.join(roles), ', '.join(flags)])

    try:
        table = TerminalTable(options.table_type, table_data, wrap_columns=[1, 2])
        console(table.output)
    except TerminalTableError as e:
        console('ERROR: %s' % str(e))
        return
    console(colorize('green', ' Built-in plugins'))
github Flexget / Flexget / flexget / plugins / cli / archive.py View on Github external
table_data.append(['URL', archived_entry.url])
            table_data.append(['Source(s)', source_names or 'N/A'])
            table_data.append(['Tag(s)', tag_names or 'N/A'])
            if archived_entry.description:
                table_data.append(['Description', strip_html(archived_entry.description)])
            table_data.append([])
    if not table_data:
        console('No results found for search')
        return

    try:
        table = TerminalTable(options.table_type, table_data, wrap_columns=[1])
        table.table.inner_heading_row_border = False
        console(table.output)
    except TerminalTableError as e:
        console('ERROR: %s' % str(e))
github Flexget / Flexget / flexget / components / managed_lists / lists / entry_list / cli.py View on Github external
def entry_list_del(options):
    with Session() as session:
        try:
            entry_list = db.get_list_by_exact_name(options.list_name)
        except NoResultFound:
            console('Could not find entry list with name `{}`'.format(options.list_name))
            return
        try:
            db_entry = db.get_entry_by_id(entry_list.id, int(options.entry), session=session)
        except NoResultFound:
            console(
                'Could not find matching entry with ID {} in list `{}`'.format(
                    int(options.entry), options.list_name
                )
            )
            return
        except ValueError:
            db_entry = db.get_entry_by_title(entry_list.id, options.entry, session=session)
            if not db_entry:
                console(
                    'Could not find matching entry with title `{}` in list `{}`'.format(
                        options.entry, options.list_name
                    )
                )
                return
        console('Removing entry `%s` from list %s' % (db_entry.title, options.list_name))
        session.delete(db_entry)
github Flexget / Flexget / flexget / components / rejected / cli.py View on Github external
def list_rejected(options):
    with Session() as session:
        results = session.query(db.RememberEntry).all()
        header = ['#', 'Title', 'Task', 'Rejected by', 'Reason']
        table_data = [header]
        for entry in results:
            table_data.append(
                [entry.id, entry.title, entry.task.name, entry.rejected_by, entry.reason or '']
            )
    try:
        table = TerminalTable(options.table_type, table_data)
        table.table.justify_columns[0] = 'center'
        console(table.output)
    except TerminalTableError as e:
        console('ERROR: %s' % str(e))
github Flexget / Flexget / flexget / components / seen / cli.py View on Github external
def seen_add(options):
    seen_name = options.add_value
    if is_imdb_url(seen_name):
        console('IMDB url detected, try to parse ID')
        imdb_id = extract_id(seen_name)
        if imdb_id:
            seen_name = imdb_id
        else:
            console("Could not parse IMDB ID")
    db.add(seen_name, 'cli_add', {'cli_add': seen_name})
    console('Added %s as seen. This will affect all tasks.' % seen_name)
github Flexget / Flexget / flexget / components / series / cli.py View on Github external
table_data.append(
                [name_column, begin, episode_id, age_col, latest_release, identifier_type]
            )
    try:
        table = TerminalTable(
            options.table_type, table_data, wrap_columns=[3], drop_columns=[4, 3, 2]
        )
        console(table.output)
    except TerminalTableError as e:
        console('ERROR: %s' % str(e))
        return
    if not porcelain:
        if not query.count():
            console('Use `flexget series list all` to view all known series.')
        else:
            console('Use `flexget series show NAME` to get detailed information.')
github Flexget / Flexget / flexget / components / managed_lists / lists / entry_list / cli.py View on Github external
console(
                'Could not find matching entry with ID {} in list `{}`'.format(
                    int(options.entry), options.list_name
                )
            )
            return
        except ValueError:
            db_entry = db.get_entry_by_title(entry_list.id, options.entry, session=session)
            if not db_entry:
                console(
                    'Could not find matching entry with title `{}` in list `{}`'.format(
                        options.entry, options.list_name
                    )
                )
                return
        console('Removing entry `%s` from list %s' % (db_entry.title, options.list_name))
        session.delete(db_entry)