How to use the flexget.plugin.priority 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 / plugins / operate / sleep.py View on Github external
    @plugin.priority(plugin.PRIORITY_FIRST)
    def on_task_output(self, task, config):
        self.do_sleep(config, 'output')
github Flexget / Flexget / flexget / components / failed / retry_failed.py View on Github external
    @plugin.priority(plugin.PRIORITY_LAST)
    def on_task_input(self, task, config):
        if config is False:
            return
        config = self.prepare_config(config)
        for entry in task.all_entries:
            entry.on_fail(self.add_failed, config=config)
github Flexget / Flexget / flexget / components / thetvdb / thetvdb_lookup.py View on Github external
    @plugin.priority(110)
    def on_task_metainfo(self, task, config):
        if not config:
            return

        language = config['language'] if not isinstance(config, bool) else 'en'

        for entry in task.entries:
            # If there is information for a series lookup, register our series lazy fields
            if entry.get('series_name') or entry.get('tvdb_id', eval_lazy=False):
                lazy_series_lookup = partial(self.lazy_series_lookup, language=language)
                lazy_series_actor_lookup = partial(
                    self.lazy_series_actor_lookup, language=language
                )
                lazy_series_poster_lookup = partial(
                    self.lazy_series_poster_lookup, language=language
                )
github Flexget / Flexget / flexget / plugins / operate / free_space.py View on Github external
    @plugin.priority(plugin.PRIORITY_FIRST)
    def on_task_download(self, task, config):
        config = self.prepare_config(config, task)
        # Only bother aborting if there were accepted entries this run.
        if task.accepted:
            if get_free_space(config['path']) < config['space']:
                log.error(
                    'Less than %d MB of free space in %s aborting task.'
                    % (config['space'], config['path'])
                )
                # backlog plugin will save and restore the task content, if available
                task.abort(
                    'Less than %d MB of free space in %s' % (config['space'], config['path'])
                )
github Flexget / Flexget / flexget / plugins / clients / qbittorrent.py View on Github external
    @plugin.priority(120)
    def on_task_download(self, task, config):
        """
        Call download plugin to generate torrent files to load into
        qBittorrent.
        """
        config = self.prepare_config(config)
        if not config['enabled']:
            return
        if 'download' not in task.config:
            download = plugin.get('download', self)
            download.get_temp_files(task, handle_magnets=True, fail_html=config['fail_html'])
github Flexget / Flexget / flexget / plugins / output / rtorrent_magnet.py View on Github external
    @plugin.priority(0)
    def on_task_output(self, task, config):

        for entry in task.accepted:
            if 'output' in entry:
                log.debug(
                    'Ignoring, %s already has an output file: %s'
                    % (entry['title'], entry['output'])
                )
                continue

            for url in entry.get('urls', [entry['url']]):
                if url.startswith('magnet:'):
                    log.debug('Magnet URI detected for url %s (%s)' % (url, entry['title']))
                    if pat.search(url):
                        self.write_torrent_file(task, entry, entry.get('path', config))
                        break
github Flexget / Flexget / flexget / plugins / input / apple_trailers.py View on Github external
    @plugin.priority(127)
    @cached('apple_trailers')
    def on_task_input(self, task, config):
        # Turn simple config into full config
        if isinstance(config, str):
            config = {'quality': config}

        try:
            r = task.requests.get(self.rss_url)
        except RequestException as e:
            raise plugin.PluginError('Retrieving Apple Trailers RSS feed failed: %s' % e)

        rss = feedparser.parse(r.content)

        if rss.get('bozo_exception', False):
            raise plugin.PluginError('Got bozo_exception (bad feed)')
github Flexget / Flexget / flexget / components / series / series_premiere.py View on Github external
    @plugin.priority(115)
    def on_task_metainfo(self, task, config):
        if not config:
            # Don't run when we are disabled
            return
        # Generate the group settings for series plugin
        group_settings = {}
        allow_seasonless = False
        desired_eps = [0, 1]
        if isinstance(config, dict):
            allow_seasonless = config.pop('allow_seasonless', False)
            if not config.pop('allow_teasers', True):
                desired_eps = [1]
            group_settings = config
        group_settings['identified_by'] = 'ep'
        # Generate a list of unique series that have premieres
        guess_entry = plugin.get('metainfo_series', self).guess_entry
github Flexget / Flexget / flexget / plugins / filter / remember_rejected.py View on Github external
    @plugin.priority(-255)
    def on_task_learn(self, task, config):
        with Session() as session:
            for entry in task.all_entries:
                if not entry.get('remember_rejected'):
                    continue
                expires = None
                if isinstance(entry['remember_rejected'], timedelta):
                    expires = datetime.now() + entry['remember_rejected']

                (remember_task_id,) = session.query(RememberTask.id).filter(RememberTask.name == task.name).first()
                session.add(RememberEntry(title=entry['title'], url=entry['original_url'], task_id=remember_task_id,
                                          rejected_by=entry.get('rejected_by'), reason=entry.get('reason'),
                                          expires=expires))
github Flexget / Flexget / flexget / components / trakt / trakt_lookup.py View on Github external
    @plugin.priority(110)
    def on_task_metainfo(self, task, config):
        if not config:
            return

        if isinstance(config, bool):
            config = dict()

        for entry in task.entries:
            if is_show(entry):
                entry.register_lazy_func(
                    TraktLazyLookup(self.series_map, self._get_series), self.series_map
                )
                # TODO cleaner way to do this?
                entry.register_lazy_func(
                    TraktLazyLookup(self.series_actor_map, self._get_series), self.series_actor_map
                )