filter Package

filter Package

Plugins for “filter” feed 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_feed_filter(feed, config)
validator()

all_series Module

class flexget.plugins.filter.all_series.FilterAllSeries

Bases: flexget.plugins.filter.series.FilterSeriesBase

Grabs all entries that appear to be series episodes in a feed.

This plugin just configures the series plugin dynamically with all series from the feed. It can take any of the options of the series plugin. Example: all_series: yes

all_series:
min_quality: hdtv max_quality: 720p propers: no
on_feed_metainfo(feed, config)
validator()

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’
get_config(feed)
on_feed_modify(feed)
parse_torrent_files(entry)
process_entry(feed, entry)
validator()

content_size Module

class flexget.plugins.filter.content_size.FilterContentSize

Bases: object

on_feed_modify(feed, config)
process_entry(feed, entry)

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

validator()

crossmatch Module

class flexget.plugins.filter.crossmatch.CrossMatch

Bases: object

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

Example:

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

List of field names in common

on_feed_filter(feed, config)
validator()

delay Module

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

Bases: sqlalchemy.ext.declarative.Base

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

Bases: object

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

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

Example:

delay: 2 hours

get_delay(config)
on_feed_input(feed, config)

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

validator()

exists Module

class flexget.plugins.filter.exists.FilterExists

Bases: object

Reject entries that already exist in given path.

Example:

exists: /storage/movies/

get_config(feed)
on_feed_filter(feed)
validator()

exists_movie Module

class flexget.plugins.filter.exists_movie.FilterExistsMovie

Bases: object

Reject existing movies.

Example:

exists_movie: /storage/movies/

build_config(config)
on_feed_filter(feed, config)
on_process_start(feed, config)
skip = ['cd1', 'cd2', 'subs', 'sample']
validator()

exists_series Module

class flexget.plugins.filter.exists_series.FilterExistsSeries

Bases: object

Intelligent series aware exists rejecting.

Example:

exists_series: /storage/series/

get_config(feed)
on_feed_filter(feed)
validator()

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

on_process_start(feed, config)

Divide the config into parts based on which phase they need to run on.

validator()
flexget.plugins.filter.if_condition.safer_eval(statement, locals)

A safer eval function. Does not allow __ or try statements, only includes certain ‘safe’ builtins.

imdb Module

class flexget.plugins.filter.imdb.FilterImdb

Bases: object

This plugin allows filtering based on IMDB score, votes and genres etc.

Configuration:

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

min_score: <num> min_votes: <num> min_year: <num> max_year: <num>

# reject if genre contains any of these reject_genres:

  • genre1
  • genre2

# reject if language contain any of these reject_languages:

  • language1

# accept only these primary languages accept_languages:

  • language1

# accept movies with any of these actors accept_actors:

  • nm0004695
  • nm0004754

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

  • nm0001191
  • nm0002071

# accept all movies by these directors accept_directors:

  • nm0000318

# reject movies by these directors reject_directors:

  • nm0093051

# reject movies/TV shows with any of these ratings reject_mpaa_ratings:

  • PG_13
  • R
  • X

# accept movies/TV shows with only these ratings accept_mpaa_ratings:

  • PG
  • G
  • TV_Y
on_feed_filter(feed, config)
validator()

Validate given configuration

imdb_rated Module

class flexget.plugins.filter.imdb_rated.FilterImdbRated

Bases: object

Reject already voted entries based on user imdb vote history.

Example:

imdb_rated: http://www.imdb.com/mymovies/list?l=<YOUR USER ID>

Reverse, reject unvoted:

Example:

imdb_rated:
url: http://www.imdb.com/mymovies/list?l=<YOUR USER ID> reverse: yes

Note: in theory this should work with any other page containing imdb urls.

on_feed_filter(feed)
update_rated(feed, config)

Update my movies list

validator()
class flexget.plugins.filter.imdb_rated.ImdbRated(url, imdb_url)

Bases: sqlalchemy.ext.declarative.Base

added
id
imdb_url
score
url

imdb_required Module

class flexget.plugins.filter.imdb_required.FilterImdbRequired

Bases: object

Rejects entries without imdb_url or imdb_id. Makes imdb lookup / search if necessary.

Example:

imdb_required: yes

on_feed_filter(feed)
validator()

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_feed_filter(feed, config)
on_process_start(feed, config)
validator()

movie_queue Module

class flexget.plugins.filter.movie_queue.FilterMovieQueue

Bases: flexget.plugins.filter.queue_base.FilterQueueBase

matches(feed, config, entry)
exception flexget.plugins.filter.movie_queue.QueueError(message, errno=0)

Bases: exceptions.Exception

Exception raised if there is an error with a queue operation

class flexget.plugins.filter.movie_queue.QueuedMovie(**kwargs)

Bases: flexget.plugins.filter.queue_base.QueuedItem

added
discriminator
downloaded
entry_original_url
entry_title
entry_url
id
imdb_id
immortal
quality
quality_obj
title
tmdb_id
flexget.plugins.filter.movie_queue.migrate_imdb_queue(manager)

If imdb_queue table is found, migrate the data to movie_queue

flexget.plugins.filter.movie_queue.validate_quality(quality)

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_feed_exit(feed, config)

Reject all entries so remember_rejected will reject them next time

on_process_start(feed, config)

Make sure the remember_rejected plugin is available

validator()

private_torrents Module

class flexget.plugins.filter.private_torrents.FilterPrivateTorrents

Bases: object

How to handle private torrents.

private_torrents: yes|no

Example:

private_torrents: no

This would reject all torrent entries with private flag.

Example:

private_torrents: yes

This would reject all public torrents.

Non-torrent content is not interviened.

on_feed_modify(feed)
validator()

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_feed_exit(feed, config)

Add downloaded movies to the database

on_feed_filter(feed, config)
validator()
class flexget.plugins.filter.proper_movies.ProperMovie

Bases: sqlalchemy.ext.declarative.Base

added
feed
id
imdb_id
proper_count
quality
title

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_feed_filter(feed, config)
prepare_config(config)
validator()

queue_base Module

class flexget.plugins.filter.queue_base.FilterQueueBase

Bases: object

Base class to handle general tasks of keeping a queue of wanted items.

matches(feed, config, entry)

This should return the QueueItem object for the match, if this entry is in the queue.

on_feed_exit(feed, config)
on_feed_filter(feed, config)
on_feed_start(feed, config)
validator()

Default validator just accepts a boolean, can be overridden by subclasses

class flexget.plugins.filter.queue_base.QueuedItem(**kwargs)

Bases: sqlalchemy.ext.declarative.Base

added
discriminator
downloaded
entry_original_url
entry_title
entry_url
id
immortal
title

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(feed, operation, regexps)
Parameters:
  • feed – Feed instance
  • operation – one of ‘accept’ ‘reject’ ‘accept_excluding’ and ‘reject_excluding’ accept and reject will be called on the entry if any of the regxps match *_excluding operations will be called if any of the regexps don’t match
  • regexps – list of {compiled_regexp: options} dictionaries
Returns:

Return list of entries that didn’t match 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:

on_feed_filter(feed, 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
validator()

reject_failed Module

class flexget.plugins.filter.reject_failed.FailedEntry(title, url)

Bases: sqlalchemy.ext.declarative.Base

count
id
title
tof
url
class flexget.plugins.filter.reject_failed.FilterRejectFailed

Bases: object

Rejects entries that have failed X or more times in the past.

on_feed_filter(feed, config)
validator()
class flexget.plugins.filter.reject_failed.PluginFailed

Bases: object

Provides tracking for failures and related commandline utilities.

add_failed(entry)

Adds entry to internal failed list, displayed with –failed

clear_failed()

Clears list of failed entries

on_entry_fail(feed, entry, **kwargs)
on_process_start(feed, config)
print_failed()

Parameter –failed

remember_rejected Module

class flexget.plugins.filter.remember_rejected.FilterRememberRejected

Bases: object

Internal. Rejects entries which have been rejected in the past.

This is enabled when item is rejected with remember=True flag.

Example:
feed.reject(entry, ‘message’, remember=True)
on_entry_reject(feed, entry, remember=None, remember_time=None, **kwargs)
on_feed_prefilter(feed, config)

Reject any remembered entries from previous runs

on_feed_start(feed, config)

Purge remembered entries if the config has changed.

class flexget.plugins.filter.remember_rejected.RememberEntry(**kwargs)

Bases: sqlalchemy.ext.declarative.Base

added
expires
feed_id
id
reason
rejected_by
title
url
class flexget.plugins.filter.remember_rejected.RememberFeed(**kwargs)

Bases: sqlalchemy.ext.declarative.Base

entries
id
name
flexget.plugins.filter.remember_rejected.db_cleanup(session)

require_field Module

class flexget.plugins.filter.require_field.FilterRequireField

Bases: object

Rejects entries without imdb url.

Example:

require_field: imdb_url

on_feed_filter(feed, config)
validator()

seen Module

Listens events:

forget (string)

Given string can be feed name, remembered field (url, imdb_url) or a title. If given value is a feed name then everything in that feed will be forgotten. With title all learned fields from it and the title will be forgotten. With field value only that particular field is forgotten.
class flexget.plugins.filter.seen.FilterSeen

Bases: object

Remembers previously downloaded content and rejects them in subsequent executions. Without this plugin FlexGet would download all matching content on every execution.

This plugin is enabled on all feeds by default. See wiki for more information.

forget(feed, title)

Forget SeenEntry with :title:. Return True if forgotten.

learn(feed, entry, fields=None, reason=None)

Marks entry as seen

on_feed_exit(feed, config)

Remember succeeded entries

on_feed_filter(feed, config, remember_rejected=False)

Filter seen entries

validator()
class flexget.plugins.filter.seen.MigrateSeen

Bases: object

migrate2()
on_process_start(feed)
class flexget.plugins.filter.seen.SeenCmd

Bases: object

on_process_start(feed)
class flexget.plugins.filter.seen.SeenEntry(title, feed, reason=None)

Bases: sqlalchemy.ext.declarative.Base

added
feed
fields
id
reason
title
class flexget.plugins.filter.seen.SeenField(field, value)

Bases: sqlalchemy.ext.declarative.Base

added
field
id
seen_entry_id
value
class flexget.plugins.filter.seen.SeenForget

Bases: object

on_process_start(feed)
class flexget.plugins.filter.seen.SeenSearch

Bases: object

on_process_start(feed)
flexget.plugins.filter.seen.db_cleanup(session)
flexget.plugins.filter.seen.forget(value)

See module docstring :param string value: Can be feed name, entry title or field value :return: count, field_count where count is number of entries removed and field_count number of fields

seen_info_hash Module

class flexget.plugins.filter.seen_info_hash.FilterSeenInfoHash

Bases: flexget.plugins.filter.seen.FilterSeen

Prevents the same torrent from being downloaded twice by remembering the infohash of all downloaded torrents.

on_feed_filter(feed, config)
on_feed_modify(feed, config)
validator()

seen_movies Module

class flexget.plugins.filter.seen_movies.FilterSeenMovies

Bases: flexget.plugins.filter.seen.FilterSeen

Prevents movies being downloaded twice. Works only on entries which have imdb url available.

How duplicate movie detection works: 1) Remember all imdb urls from downloaded entries. 2) If stored imdb url appears again, entry is rejected.

on_feed_filter(feed, config)
validator()

series Module

class flexget.plugins.filter.series.Episode(**kwargs)

Bases: sqlalchemy.ext.declarative.Base

age
Returns:Pretty string representing age of episode. eg “23d 12h” or “No releases seen”
first_seen
id
identified_by
identifier
is_premiere
number
releases
season
series_id
class flexget.plugins.filter.series.FilterSeries

Bases: flexget.plugins.filter.series.SeriesDatabase, flexget.plugins.filter.series.FilterSeriesBase

Intelligent filter for tv-series.

http://flexget.com/wiki/Plugins/series

auto_exact(config)

Automatically enable exact naming option for series that look like a problem

on_feed_exit(feed)

Learn succeeded episodes

on_feed_filter(feed)

Filter series

on_feed_metainfo(feed)
on_feed_start(feed)
on_process_start(feed)
parse_series(session, entries, series_name, config)

Search for series_name and populate all series_* fields in entries when successfully parsed

Parameters:
  • session – SQLAlchemy session
  • entries – List of entries to process
  • series_name – Series name which is being processed
  • config – Series config being processed
process_downloaded(feed, eps)

Rejects all episodes (regardless of quality) if this episode has been downloaded.

Returns:True when episode has already been downloaded
process_episode_advancement(feed, eps, series)

Rejects all episodes that are too old or new (advancement), return True when this happens.

process_min_max_quality(config, eps)

Filters eps that do not fall between min_quality and max_quality.

Returns:A list of eps that are in the acceptable range
process_propers(feed, config, eps)

Accepts needed propers. Nukes episodes from which there exists proper.

Returns:A list of episodes to continue processing.
process_qualities(feed, config, eps)

Handles all modes that can accept more than one quality per episode. (qualities, upgrade)

Returns:True - if at least one wanted quality has been downloaded or accepted. False - if no wanted qualities have been accepted
process_quality(feed, config, eps)

Accepts first episode matching the quality configured for the series.

Returns:True if accepted something
process_series(feed, series, series_name, config)

Accept or Reject episode from available releases, or postpone choosing.

Parameters:
  • feed – Current Feed
  • series – List of SeriesParser instances (?)
  • series_name – Name of series being processed
  • config – Series configuration
process_timeframe(feed, config, eps, series_name)

Runs the timeframe logic to determine if we should wait for a better quality. Saves current best to backlog if timeframe has not expired.

Returns:True - if we should keep the quality (or qualities) restriction False - if the quality restriction should be released, due to timeframe expiring
process_watched(feed, config, eps)

Rejects all episodes older than defined in watched.

Returns:True when rejected because of watched
validator()
class flexget.plugins.filter.series.FilterSeriesBase

Bases: object

Class that contains helper methods for both filter.series as well as plugins that configure it, such as all_series, series_premiere and import_series.

apply_group_options(config)

Applies group settings to each item in series group and removes settings dict.

build_options_validator(options)
combine_series_lists(*series_lists, **kwargs)

Combines the series from multiple lists, making sure there are no doubles.

If keyword argument log_once is set to True, an error message will be printed if a series is listed more than once, otherwise log_once will be used.

make_grouped_config(config)

Turns a simple series list into grouped format with a empty settings dict

merge_config(feed, config)

Merges another series config dict in with the current one.

prepare_config(config)

Generate a list of unique series from configuration. This way we don’t need to handle two different configuration formats in the logic. Applies group settings with advanced form.

class flexget.plugins.filter.series.LowerComparator(expression)

Bases: sqlalchemy.ext.hybrid.Comparator

operate(op, other)
class flexget.plugins.filter.series.Release

Bases: sqlalchemy.ext.declarative.Base

downloaded
episode_id
first_seen
id
proper
proper_count
quality
title
class flexget.plugins.filter.series.Series(**kwargs)

Bases: sqlalchemy.ext.declarative.Base

Name is handled case insensitively transparently

episodes
id
identified_by
name
name_comparator()
name_getter()
name_setter(value)
class flexget.plugins.filter.series.SeriesDatabase

Bases: object

Provides API to series database

auto_identified_by(session, name)

Determine if series name should be considered identified by episode or id format

Returns ‘ep’, ‘sequence’, ‘date’ or ‘id’ if enough history is present to identify the series’ id type. Returns ‘auto’ if there is not enough history to determine the format yet

get_downloaded(session, name, identifier)

Return list of downloaded releases for this episode

get_first_seen(session, parser, min_qual=None, max_qual=None)

Return datetime when this episode of series was first seen

get_latest_download(session, name)

Return latest downloaded episode for series name

get_latest_info(session, name)

Return latest known identifier in dict (season, episode, name) for series name

store(session, parser)

Push series information into database. Returns added/existing release.

flexget.plugins.filter.series.db_cleanup(session)
flexget.plugins.filter.series.forget_series(name)

Remove a whole series name from database.

flexget.plugins.filter.series.forget_series_episode(name, identifier)

Remove all episodes by identifier from series name from database.

flexget.plugins.filter.series.repair(manager)

Perform database repairing and upgrading at startup.

series_premiere Module

class flexget.plugins.filter.series_premiere.FilterSeriesPremiere

Bases: flexget.plugins.filter.series.FilterSeriesBase

Accept an entry that appears to be the first episode of any series.

Can be configured with any of the options of series plugin Examples:

series_premiere: yes

series_premiere:
path: ~/Media/TV/_NEW_/. quality: 720p timeframe: 12 hours

NOTE: this plugin only looks in the entry title and expects the title format to start with the series name followed by the episode info. Use the manipulate plugin to modify the entry title to match this format, if necessary.

TODO:
  • integrate thetvdb to allow refining by genres, etc.
on_feed_metainfo(feed, config)
validator()

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

series info:
series_rating series_status (Continuing or Ended) series_runtime (show runtime in minutes) series_content_rating series_genres series_network series_actors series_language (en, fr, etc.)
episode info: (if episode is found)
ep_director ep_writer ep_rating ep_guest_stars ep_air_date

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_feed_filter(feed)
validator()

Validate given configuration

torrent_alive Module

class flexget.plugins.filter.torrent_alive.TorrentAlive

Bases: object

on_feed_filter(feed, config)
on_feed_output(feed, config)
validator()
class flexget.plugins.filter.torrent_alive.TorrentAliveThread(tracker, info_hash)

Bases: threading.Thread

run()
flexget.plugins.filter.torrent_alive.get_scrape_url(tracker_url, info_hash)
flexget.plugins.filter.torrent_alive.get_tracker_seeds(url, info_hash)
flexget.plugins.filter.torrent_alive.max_seeds_from_threads(threads)

Joins the threads and returns the maximum seeds found from any of them.

Parameters:threads – A list of started `TorrentAliveThread`s
Returns:Maximum seeds found from any of the threads