How to use the flexget.plugin.DependencyError 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 / tests / test_pluginapi.py View on Github external
def test_unknown_plugin(self):
        with pytest.raises(plugin.DependencyError):
            plugin.get_plugin_by_name('nonexisting_plugin')
github Flexget / Flexget / flexget / plugins / input / rottentomatoes_list.py View on Github external
import logging

from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.cached_input import cached

try:
    # NOTE: Importing other plugins is discouraged!
    from flexget.plugins.internal import api_rottentomatoes as plugin_api_rottentomatoes
except ImportError:
    raise plugin.DependencyError(issued_by=__name__, missing='api_rottentomatoes')

log = logging.getLogger('rottentomatoes_list')


class RottenTomatoesList:
    """
    Emits an entry for each movie in a Rotten Tomatoes list.

    Configuration:

    dvds:
      - top_rentals
      - upcoming

    movies:
      - box_office
github Flexget / Flexget / flexget / plugins / metainfo / metainfo_movie.py View on Github external
from loguru import logger

from flexget import plugin
from flexget.event import event

try:
    # NOTE: Importing other plugins is discouraged!
    from flexget.components.parsing.parsers import parser_common as plugin_parser_common
except ImportError:
    raise plugin.DependencyError(issued_by=__name__, missing='parser_common')

logger = logger.bind(name='metainfo_movie')


class MetainfoMovie:
    """
    Check if entry appears to be a movie, and populate movie info if so.
    """

    schema = {'type': 'boolean'}

    def on_task_metainfo(self, task, config):
        # Don't run if we are disabled
        if config is False:
            return
        for entry in task.entries:
github Flexget / Flexget / flexget / components / tmdb / tmdb_lookup.py View on Github external
from functools import partial

from loguru import logger

from flexget import plugin
from flexget.event import event
from flexget.manager import Session
from flexget.utils.log import log_once

try:
    # NOTE: Importing other plugins is discouraged!
    from flexget.components.imdb.utils import extract_id
except ImportError:
    raise plugin.DependencyError(issued_by=__name__, missing='imdb')


logger = logger.bind(name='tmdb_lookup')


class PluginTmdbLookup:
    """Retrieves tmdb information for entries.

    Example:
        tmdb_lookup: yes
    """

    field_map = {
        'tmdb_name': 'name',
        'tmdb_id': 'id',
        'imdb_id': 'imdb_id',
github Flexget / Flexget / flexget / plugins / clients / deluge.py View on Github external
def on_task_start(self, task, config):
        """Raise a DependencyError if our dependencies aren't available"""
        try:
            from deluge.ui.client import client  # noqa
        except ImportError as e:
            log.debug('Error importing deluge: %s' % e)
            raise plugin.DependencyError('deluge', 'deluge',
                                         'Deluge >=1.2 module and it\'s dependencies required. ImportError: %s' % e,
                                         log)
        try:
            from twisted.internet import reactor  # noqa
        except:
            raise plugin.DependencyError('deluge', 'twisted.internet', 'Twisted.internet package required', log)
github Flexget / Flexget / flexget / components / managed_lists / lists / movie_list / movie_list.py View on Github external
from sqlalchemy import func
from sqlalchemy.sql.elements import and_

from flexget import plugin
from flexget.db_schema import with_session
from flexget.event import event
from flexget.manager import Session
from flexget.utils.tools import split_title_year

from . import db

try:
    # NOTE: Importing other plugins is discouraged!
    from flexget.components.parsing.parsers import parser_common as plugin_parser_common
except ImportError:
    raise plugin.DependencyError(issued_by=__name__, missing='parser_common')

log = logging.getLogger('movie_list')


class MovieListBase:
    """
    Class that contains helper methods for movie list as well as plugins that use it,
    such as API and CLI.
    """

    @property
    def supported_ids(self):
        # Return a list of supported series identifier as registered via their plugins
        return [
            p.instance.movie_identifier for p in plugin.get_plugins(interface='movie_metainfo')
        ]
github Flexget / Flexget / flexget / plugins / plugin_rarfile.py View on Github external
def on_task_output(self, task, config):
        """Task handler for rar_extract"""
        if isinstance(config, bool) and not config:
            return

        # Fail if rarfile is missing
        if not rarfile:
            raise plugin.DependencyError(issued_by='rar_extract', 
                             missing='rarfile', 
                             message='rarfile plugin requires the rarfile Python\
                                      module.')


        config = self.prepare_config(config)

        # Set the path of the unrar tool if it's not specified in PATH
        unrar_tool = config['unrar_tool']
        if unrar_tool:
            rarfile.UNRAR_TOOL = unrar_tool
            log.debug('Set RarFile.unrar_tool to: %s' % unrar_tool)

        for entry in task.accepted:
            self.handle_entry(entry, config)
github Flexget / Flexget / flexget / components / thetvdb / thetvdb_lookup.py View on Github external
import logging
from functools import partial

from flexget import plugin
from flexget.event import event
from flexget.utils.database import with_session

try:
    # NOTE: Importing other plugins is discouraged!
    from flexget.components.thetvdb import api_tvdb as plugin_api_tvdb
except ImportError:
    raise plugin.DependencyError(issued_by=__name__, missing='api_tvdb')

log = logging.getLogger('thetvdb_lookup')


class PluginThetvdbLookup:
    """Retrieves TheTVDB information for entries. Uses series_name,
    series_season, series_episode from series plugin.

    Example:

    thetvdb_lookup: yes

    Primarily used for passing thetvdb information to other plugins.
    Among these is the IMDB url for the series.

    This information is provided (via entry):
github Flexget / Flexget / flexget / plugins / cli / series.py View on Github external
from __future__ import unicode_literals, division, absolute_import
import argparse
from datetime import datetime, timedelta
from sqlalchemy import func

from flexget import options, plugin
from flexget.event import event
from flexget.logger import console
from flexget.manager import Session

try:
    from flexget.plugins.filter.series import (Series, Episode, Release, SeriesTask, forget_series,
                                               forget_series_episode, set_series_begin, normalize_series_name,
                                               new_eps_after, get_latest_release)
except ImportError:
    raise plugin.DependencyError(issued_by='cli_series', missing='series',
                                 message='Series commandline interface not loaded')


def do_cli(manager, options):
    if options.series_action == 'list':
        display_summary(options)
    elif options.series_action == 'show':
        display_details(options.series_name)
    elif options.series_action == 'forget':
        forget(manager, options)
    elif options.series_action == 'begin':
        begin(manager, options)


def display_summary(options):
    """
github Flexget / Flexget / flexget / plugins / cli / movie_queue.py View on Github external
from argparse import ArgumentParser

from sqlalchemy.exc import OperationalError

from flexget import options
from flexget.event import event
from flexget.logger import console
from flexget.plugin import DependencyError
from flexget.utils import qualities

try:
    from flexget.plugins.filter.movie_queue import (QueueError, queue_add, queue_del, queue_get, queue_forget,
                                                    queue_clear, parse_what)
except ImportError:
    raise DependencyError(issued_by='cli_movie_queue', missing='movie_queue')


def do_cli(manager, options):
    """Handle movie-queue subcommand"""
    console('WARNING!: movie_queue plugin is deprecated. Please switch to using movie_list\n')

    if options.queue_action == 'list':
        queue_list(options)
        return

    # If the action affects make sure all entries are processed again next run.
    manager.config_changed()

    if options.queue_action == 'clear':
        clear(options)
        return