flexget.plugins.output.download module#

class flexget.plugins.output.download.PluginDownload[source]#

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)[source]#
cleanup_temp_files(task)[source]#

Check all entries for leftover temp files and deletes them.

download_entry(task, entry, url, tmp_path)[source]#

Download entry by using url.

Raises:

Several types of exceptions …

Raises:

PluginWarning

filename_ext_from_mime(entry)[source]#

Try to set filename extension from mime-type.

filename_from_headers(entry, response)[source]#

Check 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')[source]#

Download entry content and store in temporary folder.

Fail 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')[source]#

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)[source]#

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

on_task_download(task, config)[source]#
on_task_learn(task, config)[source]#

Make sure all temp files are cleaned up after output phase.

on_task_output(task, config)[source]#

Move downloaded content from temp folder to final destination.

output(task, entry, config)[source]#

Move temp-file into final destination.

Raises:

PluginError if operation fails

process_config(config)[source]#

Return plugin configuration in advanced form.

process_entry(task, entry, url, tmp_path)[source]#

Process entry by using url. Do not use entry[‘url’].

Do not fail the entry if there is a network issue, instead just log and return 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)[source]#
schema = {'oneOf': [{'additionalProperties': False, 'properties': {'fail_html': {'default': True, 'type': 'boolean'}, 'filename': {'type': 'string'}, 'overwrite': {'default': False, 'type': 'boolean'}, 'path': {'format': 'path', 'type': 'string'}, 'temp': {'format': 'path', 'type': 'string'}}, 'title': 'specify options', 'type': 'object'}, {'format': 'path', 'title': 'specify path', 'type': 'string'}, {'enum': [True], 'title': 'no options', 'type': 'boolean'}]}#
flexget.plugins.output.download.register_parser_arguments()[source]#
flexget.plugins.output.download.register_plugin()[source]#