output Package

output Package

Plugins for “output” task phase.

download Module

class flexget.plugins.output.download.PluginDownload

Bases: object

Downloads content from entry url and writes it into a file.

Example:

download: ~/torrents/

Allow HTML content:

By default download plugin reports failure if received content is a html. Usually this is some sort of custom error page without proper http code and thus entry is assumed to be downloaded incorrectly.

In the rare case you actually need to retrieve html-pages you must disable this feature.

Example:

download:
  path: ~/something/
  fail_html: no

You may use commandline parameter –dl-path to temporarily override all paths to another location.

cleanup_temp_file(entry)
cleanup_temp_files(task)

Checks all entries for leftover temp files and deletes them.

download_entry(task, entry, url, tmp_path)

Downloads entry by using url.

Raises:Several types of exceptions ...
Raises:PluginWarning
filename_ext_from_mime(entry)

Tries to set filename extension from mime-type

filename_from_headers(entry, response)

Checks entry filename if it’s found from content-disposition

get_temp_file(task, entry, require_path=False, handle_magnets=False, fail_html=True, tmp_path='/tmp')

Download entry content and store in temporary folder. Fails entry with a reason if there was problem.

Parameters:
  • require_path (bool) – whether or not entries without ‘path’ field are ignored
  • handle_magnets (bool) – when used any of urls containing magnet link will replace url, otherwise warning is printed.
  • fail_html – fail entries which url respond with html content
  • tmp_path – path to use for temporary files while downloading
get_temp_files(task, require_path=False, handle_magnets=False, fail_html=True, tmp_path='/tmp')

Download all task content and store in temporary folder.

Parameters:
  • require_path (bool) – whether or not entries without ‘path’ field are ignored
  • handle_magnets (bool) – when used any of urls containing magnet link will replace url, otherwise warning is printed.
  • fail_html – fail entries which url respond with html content
  • tmp_path – path to use for temporary files while downloading
on_task_abort(task, config)

Make sure all temp files are cleaned up when task is aborted.

on_task_download(task, config)
on_task_learn(task, config)

Make sure all temp files are cleaned up after output phase

on_task_output(task, config)

Move downloaded content from temp folder to final destination

output(task, entry, config)

Moves temp-file into final destination

Raises:
PluginError if operation fails
process_config(config)

Return plugin configuration in advanced form

process_entry(task, entry, url, tmp_path)

Processes entry by using url. Does not use entry[‘url’]. Does not fail the entry if there is a network issue, instead just logs and returns a string error.

Parameters:
  • task – Task
  • entry – Entry
  • url – Url to try download
  • tmp_path – Path to store temporary files
Returns:

String error, if failed.

save_error_page(entry, task, page)
schema = {u'oneOf': [{u'additionalProperties': False, u'type': u'object', u'properties': {u'temp': {u'type': u'string', u'format': u'path'}, u'path': {u'type': u'string', u'format': u'path'}, u'fail_html': {u'default': True, u'type': u'boolean'}, u'overwrite': {u'default': False, u'type': u'boolean'}}, u'title': u'specify options'}, {u'format': u'path', u'type': u'string', u'title': u'specify path'}, {u'enum': [True], u'type': u'boolean', u'title': u'no options'}]}
flexget.plugins.output.download.register_parser_arguments()
flexget.plugins.output.download.register_plugin()

dump Module

class flexget.plugins.output.dump.OutputDump

Bases: object

Outputs all entries to console

on_task_output(task, config)
schema = {u'type': u'boolean'}
flexget.plugins.output.dump.dump(entries, debug=False, eval_lazy=False, trace=False, title_only=False)

Dump entries to stdout

Parameters:
  • entries (list) – Entries to be dumped.
  • debug (bool) – Print non printable fields as well.
  • eval_lazy (bool) – Evaluate lazy fields.
  • trace (bool) – Display trace information.
  • title_only (bool) – Display only title field
flexget.plugins.output.dump.register_parser_arguments()
flexget.plugins.output.dump.register_plugin()

dump_config Module

class flexget.plugins.output.dump_config.OutputDumpConfig

Bases: object

Dumps task config in STDOUT in yaml at exit or abort event.

on_task_start(task, config)
flexget.plugins.output.dump_config.register_parser_arguments()
flexget.plugins.output.dump_config.register_plugin()

exec Module

class flexget.plugins.output.exec.EscapingDict(mapping)

Bases: _abcoll.MutableMapping

Helper class, same as a dict, but returns all string value with quotes escaped.

class flexget.plugins.output.exec.PluginExec

Bases: object

Execute commands

Simple example, xecute command for entries that reach output:

exec: echo 'found {{title}} at {{url}}' > file

Advanced Example:

exec:
  on_start:
    phase: echo "Started"
  on_input:
    for_entries: echo 'got {{title}}'
  on_output:
    for_accepted: echo 'accepted {{title}} - {{url}} > file

You can use all (available) entry fields in the command.

HANDLED_PHASES = [u'start', u'input', u'filter', u'output', u'exit']
NAME = u'exec'
execute(task, phase_name, config)
execute_cmd(cmd, allow_background, encoding)
prepare_config(config)
schema = {u'definitions': {u'phaseSettings': {u'additionalProperties': False, u'type': u'object', u'properties': {u'phase': {u'oneOf': [{u'minItems': 1, u'items': {u'type': u'string', u'title': u'single value'}, u'type': u'array', u'title': u'multiple values'}, {u'type': u'string', u'title': u'single value'}]}, u'for_rejected': {u'oneOf': [{u'minItems': 1, u'items': {u'type': u'string', u'title': u'single value'}, u'type': u'array', u'title': u'multiple values'}, {u'type': u'string', u'title': u'single value'}]}, u'for_entries': {u'oneOf': [{u'minItems': 1, u'items': {u'type': u'string', u'title': u'single value'}, u'type': u'array', u'title': u'multiple values'}, {u'type': u'string', u'title': u'single value'}]}, u'for_failed': {u'oneOf': [{u'minItems': 1, u'items': {u'type': u'string', u'title': u'single value'}, u'type': u'array', u'title': u'multiple values'}, {u'type': u'string', u'title': u'single value'}]}, u'for_accepted': {u'oneOf': [{u'minItems': 1, u'items': {u'type': u'string', u'title': u'single value'}, u'type': u'array', u'title': u'multiple values'}, {u'type': u'string', u'title': u'single value'}]}}}}, u'oneOf': [{u'oneOf': [{u'minItems': 1, u'items': {u'type': u'string', u'title': u'single value'}, u'type': u'array', u'title': u'multiple values'}, {u'type': u'string', u'title': u'single value'}]}, {u'additionalProperties': False, u'type': u'object', u'properties': {u'fail_entries': {u'type': u'boolean'}, u'auto_escape': {u'type': u'boolean'}, u'allow_background': {u'type': u'boolean'}, u'on_start': {u'$ref': u'#/definitions/phaseSettings'}, u'encoding': {u'type': u'string'}, u'on_output': {u'$ref': u'#/definitions/phaseSettings'}, u'on_exit': {u'$ref': u'#/definitions/phaseSettings'}, u'on_input': {u'$ref': u'#/definitions/phaseSettings'}, u'on_filter': {u'$ref': u'#/definitions/phaseSettings'}}}]}
flexget.plugins.output.exec.register_plugin()

history Module

html Module

class flexget.plugins.output.html.OutputHtml
on_task_output(task, config)
schema = {u'additionalProperties': False, u'required': [u'file'], u'type': u'object', u'properties': {u'file': {u'type': u'string'}, u'template': {u'type': u'string'}}}
flexget.plugins.output.html.register_plugin()

move Module

class flexget.plugins.output.move.BaseFileOps

Bases: object

clean_source(task, config, entry)
log = None
on_task_output(task, config)
class flexget.plugins.output.move.CopyFiles

Bases: flexget.plugins.output.move.TransformingOps

Copy all accepted files.

destination_field = u'copy_to'
log = <flexget.logger.FlexGetLogger object>
move = False
schema = {u'oneOf': [{u'type': u'boolean'}, {u'additionalProperties': False, u'type': u'object', u'properties': {u'unpack_safety': {u'type': u'boolean'}, u'filename': {u'type': u'string'}, u'to': {u'type': u'string', u'format': u'path'}, u'keep_extension': {u'type': u'boolean'}, u'along': {u'items': {u'type': u'string'}, u'type': u'array'}, u'allow_dir': {u'type': u'boolean'}}}]}
class flexget.plugins.output.move.DeleteFiles

Bases: flexget.plugins.output.move.BaseFileOps

Delete all accepted files.

handle_entry(task, config, entry, siblings)
log = <flexget.logger.FlexGetLogger object>
schema = {u'oneOf': [{u'type': u'boolean'}, {u'additionalProperties': False, u'type': u'object', u'properties': {u'clean_source': {u'type': u'number'}, u'allow_dir': {u'type': u'boolean'}, u'along': {u'items': {u'type': u'string'}, u'type': u'array'}}}]}
class flexget.plugins.output.move.MoveFiles

Bases: flexget.plugins.output.move.TransformingOps

Move all accepted files.

destination_field = u'move_to'
log = <flexget.logger.FlexGetLogger object>
move = True
schema = {u'oneOf': [{u'type': u'boolean'}, {u'additionalProperties': False, u'type': u'object', u'properties': {u'clean_source': {u'type': u'number'}, u'unpack_safety': {u'type': u'boolean'}, u'filename': {u'type': u'string'}, u'to': {u'type': u'string', u'format': u'path'}, u'keep_extension': {u'type': u'boolean'}, u'along': {u'items': {u'type': u'string'}, u'type': u'array'}, u'allow_dir': {u'type': u'boolean'}}}]}
class flexget.plugins.output.move.TransformingOps

Bases: flexget.plugins.output.move.BaseFileOps

destination_field = None
handle_entry(task, config, entry, siblings)
move = None
flexget.plugins.output.move.get_directory_size(directory)
Parameters:directory – Path
Returns:Size in bytes (recursively)
flexget.plugins.output.move.register_plugin()

notifymyandroid Module

class flexget.plugins.output.notifymyandroid.OutputNotifyMyAndroid

Bases: object

Example:

notifymyandroid:
  apikey: xxxxxxx
  [application: application name, default FlexGet]
  [event: event title, default New Release]
  [priority: -2 - 2 (2 = highest), default 0]

Configuration parameters are also supported from entries (eg. through set).

on_task_output(task, config)
schema = {u'additionalProperties': False, u'required': [u'apikey'], u'type': u'object', u'properties': {u'priority': {u'default': 0, u'type': u'integer'}, u'application': {u'default': u'FlexGet', u'type': u'string'}, u'apikey': {u'type': u'string'}, u'event': {u'default': u'New release', u'type': u'string'}, u'description': {u'default': u'{{title}}', u'type': u'string'}}}
flexget.plugins.output.notifymyandroid.register_plugin()

prowl Module

class flexget.plugins.output.prowl.OutputProwl

Bases: object

Send prowl notifications

Example:

prowl:
  apikey: xxxxxxx
  [application: application name, default FlexGet]
  [event: event title, default New Release]
  [priority: -2 - 2 (2 = highest), default 0]
  [description: notification to send]

Configuration parameters are also supported from entries (eg. through set).

on_task_output(task, config)
schema = {u'additionalProperties': False, u'required': [u'apikey'], u'type': u'object', u'properties': {u'priority': {u'default': 0, u'type': u'integer'}, u'application': {u'default': u'FlexGet', u'type': u'string'}, u'apikey': {u'type': u'string'}, u'event': {u'default': u'New Release', u'type': u'string'}, u'description': {u'type': u'string'}}}
flexget.plugins.output.prowl.register_plugin()

pyload Module

class flexget.plugins.output.pyload.PluginPyLoad

Bases: object

Parse task content or url for hoster links and adds them to pyLoad.

Example:

pyload:
  api: http://localhost:8000/api
  queue: yes
  username: my_username
  password: my_password
  folder: desired_folder
  package: desired_package_name (jinja2 supported)
  hoster:
    - YoutubeCom
  parse_url: no
  multiple_hoster: yes
  enabled: yes

Default values for the config elements:

pyload:
    api: http://localhost:8000/api
    queue: no
    hoster: ALL
    parse_url: no
    multiple_hoster: yes
    enabled: yes
DEFAULT_API = u'http://localhost:8000/api'
DEFAULT_FOLDER = u''
DEFAULT_HANDLE_NO_URL_AS_FAILURE = False
DEFAULT_HOSTER = []
DEFAULT_MULTIPLE_HOSTER = True
DEFAULT_PARSE_URL = False
DEFAULT_PREFERRED_HOSTER_ONLY = False
DEFAULT_QUEUE = False
add_entries(task, config)

Adds accepted entries

on_task_output(task, config)
schema = {u'oneOf': [{u'type': u'boolean'}, {u'additionalProperties': False, u'type': u'object', u'properties': {u'username': {u'type': u'string'}, u'hoster': {u'oneOf': [{u'minItems': 1, u'items': {u'type': u'string', u'title': u'single value'}, u'type': u'array', u'title': u'multiple values'}, {u'type': u'string', u'title': u'single value'}]}, u'parse_url': {u'type': u'boolean'}, u'api': {u'type': u'string'}, u'password': {u'type': u'string'}, u'package': {u'type': u'string'}, u'multiple_hoster': {u'type': u'boolean'}, u'enabled': {u'type': u'boolean'}, u'queue': {u'type': u'boolean'}, u'preferred_hoster_only': {u'type': u'boolean'}, u'handle_no_url_as_failure': {u'type': u'boolean'}, u'folder': {u'type': u'string'}}}]}
class flexget.plugins.output.pyload.PyloadApi(requests, url)

Bases: object

get_session(config)
query(method, post=None)
flexget.plugins.output.pyload.register_plugin()

queue_movies Module

rss Module

class flexget.plugins.output.rss.OutputRSS

Bases: object

Write RSS containing succeeded (downloaded) entries.

Example:

make_rss: ~/public_html/flexget.rss

You may write into same file in multiple tasks.

Example:

my-task-A:
  make_rss: ~/public_html/series.rss
  .
  .
my-task-B:
  make_rss: ~/public_html/series.rss
  .
  .

With this example file series.rss would contain succeeded entries from both tasks.

Number of days / items

By default output contains items from last 7 days. You can specify different perioid, number of items or both. Value -1 means unlimited.

Example:

make_rss:
  file: ~/public_html/series.rss
  days: 2
  items: 10

Generate RSS that will containing last two days and no more than 10 items.

Example 2:

make_rss:
  file: ~/public_html/series.rss
  days: -1
  items: 50

Generate RSS that will contain last 50 items, regardless of dates.

RSS location link:

You can specify the url location of the rss file.

Example:

make_rss:
  file: ~/public_html/series.rss
  rsslink: http://my.server.net/series.rss

RSS link

You can specify what field from entry is used as a link in generated rss feed.

Example:

make_rss:
  file: ~/public_html/series.rss
  link:
    - imdb_url

List should contain a list of fields in order of preference. Note that the url field is always used as last possible fallback even without explicitly adding it into the list.

Default list: imdb_url, input_url, url

on_task_exit(task, config)

Store finished / downloaded entries at exit

on_task_output(task, config)
prepare_config(config)
schema = {u'oneOf': [{u'type': u'string'}, {u'additionalProperties': False, u'required': [u'file'], u'type': u'object', u'properties': {u'link': {u'items': {u'type': u'string'}, u'type': u'array'}, u'title': {u'type': u'string'}, u'file': {u'type': u'string'}, u'encoding': {u'type': u'string'}, u'items': {u'type': u'integer'}, u'rsslink': {u'type': u'string'}, u'days': {u'type': u'integer'}, u'template': {u'type': u'string'}, u'history': {u'type': u'boolean'}}}]}
class flexget.plugins.output.rss.RSSEntry(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

description
file
id
published
title
flexget.plugins.output.rss.register_plugin()

sabnzbd Module

class flexget.plugins.output.sabnzbd.OutputSabnzbd

Bases: object

Example:

sabnzbd:
  apikey: 123456
  url: http://localhost/sabnzbd/api?
  category: movies

All parameters:

sabnzbd:
  apikey: ...
  url: ...
  category: ...
  script: ...
  pp: ...
  priority: ...
get_params(config)
on_task_output(task, config)
schema = {u'additionalProperties': False, u'required': [u'key', u'url'], u'type': u'object', u'properties': {u'category': {u'type': u'string'}, u'priority': {u'type': u'integer'}, u'pp': {u'type': u'string'}, u'key': {u'type': u'string'}, u'script': {u'type': u'string'}, u'url': {u'type': u'string', u'format': u'url'}, u'username': {u'type': u'string'}, u'password': {u'type': u'string'}}}
flexget.plugins.output.sabnzbd.register_plugin()

send_email Module

class flexget.plugins.output.send_email.OutputEmail

Bases: object

Send an e-mail with the list of all succeeded (downloaded) entries.

Configuration options

Option Description
from The email address from which the email will be sent (required)
to The email address of the recipient (required)
smtp_host The host of the smtp server
smtp_port The port of the smtp server
smtp_username The username to use to connect to the smtp server
smtp_password The password to use to connect to the smtp server
smtp_tls Should we use TLS to connect to the smtp server
smtp_ssl Should we use SSL to connect to the smtp server Due to a bug in python, this only works in python 2.6.3 and up
active Is this plugin active or not

Config basic example:

email:
  from: xxx@xxx.xxx
  to: xxx@xxx.xxx
  smtp_host: smtp.host.com

Config example with smtp login:

email:
  from: xxx@xxx.xxx
  to: xxx@xxx.xxx
  smtp_host: smtp.host.com
  smtp_port: 25
  smtp_login: true
  smtp_username: my_smtp_login
  smtp_password: my_smtp_password
  smtp_tls: true

Config multi-task example:

global:
  email:
    from: xxx@xxx.xxx
    to: xxx@xxx.xxx
    smtp_host: smtp.host.com

tasks:
  task1:
    rss: http://xxx
  task2:
    rss: http://yyy
    email:
      active: False
  task3:
    rss: http://zzz
    email:
      to: zzz@zzz.zzz

GMAIL example:

from: from@gmail.com
to: to@gmail.com
smtp_host: smtp.gmail.com
smtp_port: 587
smtp_login: true
smtp_username: gmailUser
smtp_password: gmailPassword
smtp_tls: true

Default values for the config elements:

email:
  active: True
  smtp_host: localhost
  smtp_port: 25
  smtp_login: False
  smtp_username:
  smtp_password:
  smtp_tls: False
  smtp_ssl: False
on_task_abort(task, config)
on_task_output(task, config)
schema = {u'additionalProperties': False, u'required': [u'to', u'from'], u'type': u'object', u'properties': {u'smtp_password': {u'default': u'', u'type': u'string'}, u'global': {u'type': u'boolean'}, u'smtp_host': {u'default': u'localhost', u'type': u'string'}, u'smtp_tls': {u'default': False, u'type': u'boolean'}, u'active': {u'default': True, u'type': u'boolean'}, u'smtp_login': {u'default': False, u'type': u'boolean'}, u'subject': {u'type': u'string'}, u'from': {u'type': u'string'}, u'smtp_ssl': {u'default': False, u'type': u'boolean'}, u'smtp_port': {u'default': 25, u'type': u'integer'}, u'to': {u'oneOf': [{u'minItems': 1, u'items': {u'type': u'string', u'title': u'single value'}, u'type': u'array', u'title': u'multiple values'}, {u'type': u'string', u'title': u'single value'}]}, u'template': {u'default': u'default.template', u'type': u'string'}, u'smtp_username': {u'default': u'', u'type': u'string'}}}
flexget.plugins.output.send_email.global_send(manager, options)
flexget.plugins.output.send_email.prepare_config(config)
flexget.plugins.output.send_email.register_config_key()
flexget.plugins.output.send_email.register_plugin()
flexget.plugins.output.send_email.send_email(subject, content, config)

Send email at exit.

flexget.plugins.output.send_email.setup(manager, options)

subtitles Module

class flexget.plugins.output.subtitles.Subtitles

Bases: object

Fetch subtitles from opensubtitles.org

on_task_download(task, config)
prepare_config(config, task)
schema = {u'additionalProperties': False, u'type': u'object', u'properties': {u'languages': {u'default': [u'eng'], u'items': {u'type': u'string'}, u'type': u'array'}, u'match_limit': {u'default': 0.8, u'type': u'number'}, u'output': {u'type': u'string', u'format': u'path'}, u'min_sub_rating': {u'default': 0.0, u'type': u'number'}}}
flexget.plugins.output.subtitles.register_plugin()