filter Package

filter Package

Plugins for “filter” task phase, and non-modifying download filters.

accept_all Module

class flexget.plugins.filter.accept_all.FilterAcceptAll

Bases: object

Just accepts all entries.

Example:

accept_all: true
on_task_filter(task, config)
schema = {'type': 'boolean'}
flexget.plugins.filter.accept_all.register_plugin()

all_series Module

content_filter Module

class flexget.plugins.filter.content_filter.FilterContentFilter

Bases: object

Rejects entries based on the filenames in the content. Torrent files only right now.

Example:

content_filter:
  require:
    - '*.avi'
    - '*.mkv'
on_task_modify(task, config)
prepare_config(config)
process_entry(task, entry, config)

Process an entry and reject it if it doesn’t pass filter.

Parameters:
  • task – Task entry belongs to.

  • entry – Entry to process

Returns:

True, if entry was rejected.

schema = {'additionalProperties': False, 'properties': {'max_files': {'type': 'integer'}, 'min_files': {'type': 'integer'}, 'reject': {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'title': 'single value'}]}, 'require': {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'title': 'single value'}]}, 'require_all': {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'title': 'single value'}]}, 'require_mainfile': {'default': False, 'type': 'boolean'}, 'strict': {'default': False, 'type': 'boolean'}}, 'type': 'object'}
flexget.plugins.filter.content_filter.register_plugin()

content_size Module

class flexget.plugins.filter.content_size.FilterContentSize

Bases: object

on_task_filter(task, config)
on_task_modify(task, config)
static process_config(config: dict) Tuple[int | None, int | None]
process_entry(task, entry, config, remember=True)

Rejects this entry if it does not pass content_size requirements. Returns true if the entry was rejected.

schema = {'additionalProperties': False, 'properties': {'max': {'format': 'size', 'type': ['number', 'string']}, 'min': {'format': 'size', 'type': ['number', 'string']}, 'strict': {'default': True, 'type': 'boolean'}}, 'type': 'object'}
flexget.plugins.filter.content_size.register_plugin()

crossmatch Module

class flexget.plugins.filter.crossmatch.CrossMatch

Bases: object

Perform action based on item on current task and other inputs.

Example:

crossmatch:
  from:
    - rss: http://example.com/
  fields:
    - title
  action: reject
  exact: yes
  case_sensitive: yes
entry_intersects(e1, e2, fields=None, exact=True, case_sensitive=True)
Parameters:
Returns:

List of field names in common

on_task_filter(task, config)
schema = {'additionalProperties': False, 'properties': {'action': {'enum': ['accept', 'reject']}, 'all_fields': {'default': False, 'type': 'boolean'}, 'case_sensitive': {'default': True, 'type': 'boolean'}, 'exact': {'default': True, 'type': 'boolean'}, 'fields': {'items': {'type': 'string'}, 'type': 'array'}, 'from': {'items': {'$ref': '/schema/plugins?phase=input'}, 'type': 'array'}}, 'required': ['fields', 'action', 'from'], 'type': 'object'}
flexget.plugins.filter.crossmatch.register_plugin()

delay Module

class flexget.plugins.filter.delay.DelayedEntry(**kwargs)

Bases: VersionedBase

entry
expire
id
task
title
class flexget.plugins.filter.delay.FilterDelay

Bases: object

Add delay to a task. This is useful for de-prioritizing expensive / bad-quality tasks.

Format: n [minutes|hours|days|weeks]

Example:

delay: 2 hours
get_delay(config)
on_task_input(task, config)

Captures the current input then replaces it with entries that have passed the delay.

schema = {'format': 'interval', 'type': 'string'}
flexget.plugins.filter.delay.register_plugin()

exists Module

class flexget.plugins.filter.exists.FilterExists

Bases: object

Reject entries that already exist in given path.

Example:

exists: /storage/movies/
on_task_filter(task, config)
prepare_config(config)
schema = {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'format': 'path', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'format': 'path', 'title': 'single value'}]}
flexget.plugins.filter.exists.register_plugin()

exists_movie Module

class flexget.plugins.filter.exists_movie.FilterExistsMovie

Bases: object

Reject existing movies.

Syntax:

exists_movie:

path: /path/to/movies [type: {dirs|files}] [allow_different_qualities: {better|yes|no}] [lookup: {imdb|no}]

dir_pattern = re.compile('\\b(cd.\\d|subs?|samples?)\\b', re.IGNORECASE)
file_pattern = re.compile('\\.(avi|mkv|mp4|mpg|webm)$', re.IGNORECASE)
on_task_filter(task, config)
prepare_config(config)
schema = {'anyOf': [{'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'format': 'path', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'format': 'path', 'title': 'single value'}]}, {'type': 'object', 'properties': {'path': {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'format': 'path', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'format': 'path', 'title': 'single value'}]}, 'allow_different_qualities': {'enum': ['better', True, False], 'default': False}, 'type': {'enum': ['files', 'dirs'], 'default': 'dirs'}, 'lookup': {'enum': ['imdb', False], 'default': False}}, 'required': ['path'], 'additionalProperties': False}]}
flexget.plugins.filter.exists_movie.merge_found_qualities(existing_qualities: Dict[str, set], new_qualities: Dict[str, set])

Merge the qualities from new_qualities dict into existing_qualities dict.

flexget.plugins.filter.exists_movie.register_plugin()

exists_series Module

class flexget.plugins.filter.exists_series.FilterExistsSeries

Bases: object

Intelligent series aware exists rejecting.

Example:

exists_series: /storage/series/
on_task_filter(task, config)
prepare_config(config)
schema = {'anyOf': [{'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'format': 'path', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'format': 'path', 'title': 'single value'}]}, {'type': 'object', 'properties': {'path': {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'format': 'path', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'format': 'path', 'title': 'single value'}]}, 'allow_different_qualities': {'enum': ['better', True, False], 'default': False}}, 'required': ['path'], 'additionalProperties': False}]}
flexget.plugins.filter.exists_series.register_plugin()

if_condition Module

class flexget.plugins.filter.if_condition.FilterIf

Bases: object

Can run actions on entries that satisfy a given condition.

Actions include accept, reject, and fail, as well as the ability to run other filter plugins on the entries.

check_condition(condition, entry)

Checks if a given entry passes condition

schema = {'items': {'additionalProperties': {'anyOf': [{'$ref': '/schema/plugins'}, {'enum': ['accept', 'reject', 'fail']}]}, 'type': 'object'}, 'type': 'array'}
flexget.plugins.filter.if_condition.register_plugin()

imdb Module

imdb_rated Module

imdb_required Module

limit_new Module

class flexget.plugins.filter.limit_new.FilterLimitNew

Bases: object

Limit number of new items.

Example:

limit_new: 1

This would allow only one new item to pass trough per execution. Useful for passing torrents slowly into download.

Note that since this is per execution, actual rate depends how often FlexGet is executed.

on_task_filter(task, config)
schema = {'minimum': 1, 'type': 'integer'}
flexget.plugins.filter.limit_new.register_plugin()

movie_queue Module

only_new Module

class flexget.plugins.filter.only_new.FilterOnlyNew

Bases: object

Causes input plugins to only emit entries that haven’t been seen on previous runs.

on_task_learn(task, config)

Reject all entries so remember_rejected will reject them next time

on_task_start(task, config)

Make sure the remember_rejected plugin is available

schema = {'type': 'boolean'}
flexget.plugins.filter.only_new.register_plugin()

private_torrents Module

proper_movies Module

class flexget.plugins.filter.proper_movies.FilterProperMovies

Bases: object

Automatically download proper movies.

Configuration:

proper_movies: n <minutes|hours|days|weeks>

or permanently:

proper_movies: yes

Value no will disable plugin.

on_task_filter(task, config)
on_task_learn(task, config)

Add downloaded movies to the database

schema = {'oneOf': [{'type': 'boolean'}, {'type': 'string', 'format': 'interval'}]}
class flexget.plugins.filter.proper_movies.ProperMovie

Bases: Base

added
id
imdb_id
proper_count
quality
task
title
flexget.plugins.filter.proper_movies.register_plugin()

quality Module

class flexget.plugins.filter.quality.FilterQuality

Bases: object

Rejects all entries that don’t have one of the specified qualities

Example:

quality:
  - hdtv
on_task_filter(task, config)
schema = {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'format': 'quality_requirements', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'format': 'quality_requirements', 'title': 'single value'}]}
flexget.plugins.filter.quality.register_plugin()

queue_base Module

regexp Module

class flexget.plugins.filter.regexp.FilterRegexp

Bases: object

All possible forms.

regexp:
[operation]: # operation to perform on matches
  • [regexp] # simple regexp

  • [regexp]: <path> # override path

  • [regexp]:

    [path]: <path> # override path [not]: <regexp> # not match [from]: <field> # search from given entry field

  • [regexp]:

    [path]: <path> # override path [not]: # list of not match regexps

    • <regexp>

    [from]: # search only from these fields
    • <field>

[operation]:
  • <regexp>

[rest]: <operation> # non matching entries are [from]: # search only from these fields for all regexps

  • <field>

Possible operations: accept, reject, accept_excluding, reject_excluding

filter(entries, operation, regexps)
Parameters:
  • entries – entries to filter

  • operation – one of ‘accept’ ‘reject’ ‘accept_excluding’ and ‘reject_excluding’ accept and reject will be called on the entry if any of the regexps match *_excluding operations will be called if any of the regexps don’t match

  • regexps – list of {compiled_regexp: options} dictionaries

Returns:

Return set of entries that matched regexps

matches(entry, regexp, find_from=None, not_regexps=None)

Check if :entry: has any string fields or strings in a list field that match :regexp:

Parameters:
  • entry – Entry instance

  • regexp – Compiled regexp

  • find_from – None or a list of fields to search from

  • not_regexps – None or list of regexps that can NOT match

Returns:

Field matching

on_task_filter(task, config)
prepare_config(config)

Returns the config in standard format.

All regexps are turned into dictionaries in the form of {compiled regexp: options}

Parameters:

config – Dict that can optionally contain the following keys path: will be attached to entries that match set: a dict of values to be attached to entries that match via set plugin from: a list of fields in entry for the regexps to match against not: a list of compiled regexps that if matching, will disqualify the main match

Returns:

New config dictionary

schema = {'additionalProperties': False, 'definitions': {'regex_list': {'items': {'oneOf': [{'type': 'string', 'format': 'regex'}, {'type': 'object', 'additionalProperties': {'oneOf': [{'type': 'string', 'format': 'path'}, {'type': 'object', 'properties': {'path': {'type': 'string', 'format': 'path'}, 'set': {'type': 'object'}, 'not': {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'format': 'regex', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'format': 'regex', 'title': 'single value'}]}, 'from': {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'title': 'single value'}]}}, 'additionalProperties': False}]}}]}, 'type': 'array'}}, 'properties': {'accept': {'$ref': '#/definitions/regex_list'}, 'accept_excluding': {'$ref': '#/definitions/regex_list'}, 'from': {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'title': 'single value'}]}, 'reject': {'$ref': '#/definitions/regex_list'}, 'reject_excluding': {'$ref': '#/definitions/regex_list'}, 'rest': {'enum': ['accept', 'reject'], 'type': 'string'}}, 'type': 'object'}
flexget.plugins.filter.regexp.register_plugin()

retry_failed Module

remember_rejected Module

require_field Module

class flexget.plugins.filter.require_field.FilterRequireField

Bases: object

Rejects entries without defined field.

Example:

require_field: imdb_url
on_task_filter(task, config)
schema = {'oneOf': [{'title': 'multiple values', 'type': 'array', 'items': {'type': 'string', 'title': 'single value'}, 'minItems': 1, 'uniqueItems': False}, {'type': 'string', 'title': 'single value'}]}
flexget.plugins.filter.require_field.register_plugin()

seen Module

seen_info_hash Module

seen_movies Module

series Module

series_premiere Module

thetvdb Module

class flexget.plugins.filter.thetvdb.FilterTvdb

Bases: object

This plugin allows filtering based on thetvdb series rating, episode rating, status, genres, runtime, content-rating, languages, directors, writers, network, guest stars, episode rating, and actors

Configuration:

Note: All parameters are optional. Some are mutually exclusive.

min_series_rating: <num> min_episode_rating: <num> min_episode_air_year: <num> max_episode_air_year: <num> min_episode_runtime: <num> max_episode_runtime: <num>

# reject if genre contains any of these reject_content_rating:

  • TV-MA

# accept only this content rating accept_content_rating:

  • TV-PG

# accept only these networks accept_network:

  • NBC

# reject if this network reject_network:

  • ABC

# reject if genre contains any of these reject_genres:

  • drama

  • romance

# reject if status contains any of these reject_status:

  • Ended

# reject if language contain any of these reject_languages:

  • fr

# accept only this language accept_languages:

  • en

# Actors below take into account series actors, and guest stars # accept episode with any of these actors accept_actors:

  • Heidi Klum

  • Bruce Willis

# reject episode if it has any of these actors reject_actors:

  • Cher

  • Tamala Jones

# accept all episodes by these writers accept_writers:

  • Andrew W. Marlowe

# reject episodes by these writers reject_writers:

  • Barry Schindel

# accept all episodes by these directors accept_directors:

  • Rob Bowman

# reject movies by these directors reject_directors:

  • John Terlesky

is_in_set(config, configkey, entryitem)

this takes the config object, config key (to a list), and entry item so it can return True if the object matches, (be that a subset of the list, or if the entry item is contained within the config object list) or false if it does not.

on_task_filter(task, config)
schema = {'additionalProperties': False, 'properties': {'accept_actors': {'items': {'type': 'string'}, 'type': 'array'}, 'accept_content_rating': {'items': {'type': 'string'}, 'type': 'array'}, 'accept_directors': {'items': {'type': 'string'}, 'type': 'array'}, 'accept_network': {'items': {'type': 'string'}, 'type': 'array'}, 'max_episode_air_year': {'type': 'integer'}, 'max_episode_runtime': {'type': 'number'}, 'min_episode_air_year': {'type': 'integer'}, 'min_episode_rating': {'type': 'number'}, 'min_episode_runtime': {'type': 'number'}, 'min_series_rating': {'type': 'number'}, 'reject_actors': {'items': {'type': 'string'}, 'type': 'array'}, 'reject_content_rating': {'items': {'type': 'string'}, 'type': 'array'}, 'reject_directors': {'items': {'type': 'string'}, 'type': 'array'}, 'reject_genres': {'items': {'type': 'string'}, 'type': 'array'}, 'reject_network': {'items': {'type': 'string'}, 'type': 'array'}, 'reject_status': {'items': {'type': 'string'}, 'type': 'array'}}, 'type': 'object'}
flexget.plugins.filter.thetvdb.register_plugin()

torrent_alive Module