flexget Package¶
flexget
Package¶
api
Module¶
config_schema
Module¶
- exception flexget.config_schema.ConfigError¶
Bases:
ValueError
- errors: List[ConfigValidationError]¶
- exception flexget.config_schema.ConfigValidationError(message, validator=<unset>, path=(), cause=None, context=(), validator_value=<unset>, instance=<unset>, schema=<unset>, schema_path=(), parent=None, type_checker=<unset>)¶
Bases:
ValidationError
- class flexget.config_schema.RefResolver(*args, **kwargs)¶
Bases:
RefResolver
- flexget.config_schema.is_episode_or_season_id(instance)¶
- flexget.config_schema.is_quality(instance)¶
- flexget.config_schema.is_quality_req(instance)¶
- flexget.config_schema.one_or_more(schema: Dict[str, Any], unique_items: bool = False) Dict[str, Any] ¶
Helper function to construct a schema that validates items matching schema or an array containing items matching schema.
- flexget.config_schema.parse_interval(interval_string: str) timedelta ¶
Takes an interval string from the config and turns it into a
datetime.timedelta
object.
- flexget.config_schema.parse_percent(percent_input: str) float ¶
Takes a percent string from the config and turns it into a float.
- flexget.config_schema.parse_size(size_input: str, si: bool = False) int ¶
Takes a size string from the config and turns it into int(bytes).
- flexget.config_schema.parse_time(time_string: str) time ¶
Parse a time string from the config into a
datetime.time
object.
- flexget.config_schema.process_config(config: Any, schema: Dict[str, Any] | None = None, set_defaults: bool = True) List[ConfigValidationError] ¶
Validates the config, and sets defaults within it if set_defaults is set. If schema is not given, uses the root config schema.
- Returns:
A list with :class:`jsonschema.ValidationError`s if any
- flexget.config_schema.register_config_key(key: str, schema: Dict[str, Any], required: bool = False)¶
Registers a valid root level key for the config.
- flexget.config_schema.register_schema(path: str, schema: Dict[str, Any] | Callable[[...], Dict[str, Any]])¶
Register schema to be available at path for $refs
- Parameters:
path – Path to make schema available
schema – The schema, or function which returns the schema
- flexget.config_schema.resolve_ref(uri: str) Dict[str, Any] ¶
Finds and returns a schema pointed to by uri that has been registered in the register_schema function.
- flexget.config_schema.select_child_errors(validator, errors)¶
Looks through subschema errors, if any subschema is determined to be the intended one, (based on ‘type’ keyword errors,) errors from its branch will be released instead of the parent error.
- flexget.config_schema.set_error_message(error: ValidationError) None ¶
Create user facing error message from a
jsonschema.ValidationError
error
- flexget.config_schema.validate_anyOf(validator, anyOf, instance, schema)¶
- flexget.config_schema.validate_deprecated(validator, message, instance, schema)¶
Not really a validator, just warns if deprecated section of config is being used.
- flexget.config_schema.validate_oneOf(validator, oneOf, instance, schema)¶
- flexget.config_schema.validate_properties_w_defaults(validator, properties, instance, schema)¶
db_schema
Module¶
- exception flexget.db_schema.UpgradeImpossible¶
Bases:
Exception
Exception to be thrown during a db upgrade function which will cause the old tables to be removed and recreated from the new model.
- class flexget.db_schema.VersionedBaseMeta(metaname, bases, dict_)¶
Bases:
DeclarativeMeta
Metaclass for objects returned by versioned_base factory
- flexget.db_schema.after_table_create(target, connection, tables: List[Table] | None = None, **kw) None ¶
Sets the schema version to most recent for a plugin when it’s tables are freshly created.
- flexget.db_schema.upgrade(plugin: str) Callable ¶
Used as a decorator to register a schema upgrade function.
The wrapped function will be passed the current schema version and a session object. The function should return the new version of the schema after the upgrade.
There is no need to commit the session, it will commit automatically if an upgraded schema version is returned.
Example:
from flexget import schema @schema.upgrade('your_plugin') def upgrade(ver, session): if ver == 2: # upgrade ver = 3 return ver
- flexget.db_schema.versioned_base(plugin: str, version: int) VersionedBaseMeta ¶
Returns a class which can be used like Base, but automatically stores schema version when tables are created.
entry
Module¶
- class flexget.entry.Entry(*args, **kwargs)¶
Bases:
LazyDict
,Serializer
Represents one item in task. Must have url and title fields.
Stores automatically original_url key, which is necessary because plugins (eg. urlrewriters) may change url into something else and otherwise that information would be lost.
Entry will also transparently convert all ascii strings into unicode and raises
EntryUnicodeError
if conversion fails on any value being set. Such failures are caught byTask
and triggerabort()
.- add_hook(action: str, func: Callable, **kwargs) None ¶
Add a hook for
action
to this entry.- Parameters:
action (string) – One of: ‘accept’, ‘reject’, ‘fail’, ‘complete’
func – Function to execute when event occurs
kwargs – Keyword arguments that should be passed to
func
- Raises:
ValueError when given an invalid
action
- add_lazy_fields(lazy_func: Callable[[Entry], None] | str, fields: Iterable[str], args: Sequence | None = None, kwargs: Mapping | None = None)¶
Add lazy fields to an entry. :param lazy_func: should be a funciton previously registered with the register_lazy_func decorator,
or the name it was registered under.
- Parameters:
fields – list of fields this function will fill
args – Arguments that will be passed to the lazy lookup function when called.
kwargs – Keyword arguments which will be passed to the lazy lookup function when called.
- complete(**kwargs)¶
- classmethod deserialize(data, version) Entry ¶
Returns an instance of the original class, recreated from the serialized form.
- on_accept(func: Callable, **kwargs) None ¶
Register a function to be called when this entry is accepted.
- Parameters:
func – The function to call
kwargs – Keyword arguments that should be passed to the registered function
- on_complete(func: Callable, **kwargs) None ¶
Register a function to be called when a
Task
has finished processing this entry.- Parameters:
func – The function to call
kwargs – Keyword arguments that should be passed to the registered function
- on_fail(func: Callable, **kwargs) None ¶
Register a function to be called when this entry is failed.
- Parameters:
func – The function to call
kwargs – Keyword arguments that should be passed to the registered function
- on_reject(func: Callable, **kwargs) None ¶
Register a function to be called when this entry is rejected.
- Parameters:
func – The function to call
kwargs – Keyword arguments that should be passed to the registered function
- register_lazy_func(func, keys)¶
DEPRECATED. Use add_lazy_fields instead.
- render(template: str | FlexGetTemplate, native: bool = False) str ¶
Renders a template string based on fields in the entry.
- Parameters:
template – A template string or FlexGetTemplate that uses jinja2 or python string replacement format.
native – If True, and the rendering result can be all native python types, not just strings.
- Returns:
The result of the rendering.
- Return type:
string
- Raises:
RenderError – If there is a problem.
- run_hooks(action: str, **kwargs) None ¶
Run hooks that have been registered for given
action
.- Parameters:
action – Name of action to run hooks for
kwargs – Keyword arguments that should be passed to the registered functions
- classmethod serialize(entry: Entry) dict ¶
This method should be implemented to return a plain python datatype which is json serializable.
- property state: EntryState¶
- trace(message: str | None, operation: str | None = None, plugin: str | None = None) None ¶
Adds trace message to the entry which should contain useful information about why plugin did not operate on entry. Accept and Reject messages are added to trace automatically.
- Parameters:
message (string) – Message to add into entry trace.
operation (string) – None, reject, accept or fail
plugin – Uses task.current_plugin by default, pass value to override
- update_using_map(field_map: dict, source_item: dict | object, ignore_none: bool = False)¶
Populates entry fields from a source object using a dictionary that maps from entry field names to attributes (or keys) in the source object.
- Parameters:
field_map (dict) – A dictionary mapping entry field names to the attribute in source_item (or keys, if source_item is a dict)(nested attributes/dicts are also supported, separated by a dot,) or a function that takes source_item as an argument
source_item – Source of information to be used by the map
ignore_none – Ignore any None values, do not record it to the Entry
- class flexget.entry.EntryState(value)¶
Bases:
Enum
An enumeration.
- ACCEPTED = 'accepted'¶
- FAILED = 'failed'¶
- REJECTED = 'rejected'¶
- UNDECIDED = 'undecided'¶
event
Module¶
Provides small event framework
- class flexget.event.Event(name: str, func: Callable, priority: int = 128)¶
Bases:
object
Represents one registered event.
- flexget.event.add_event_handler(name: str, func: Callable, priority: int = 128) Event ¶
- Parameters:
name (string) – Event name
func (function) – Function that acts as event handler
priority – Priority for this hook
- Returns:
Event created
- Return type:
- Raises:
Exception – If func is already registered in an event
- flexget.event.event(name: str, priority: int = 128) Callable[[Callable], Callable] ¶
Register event to function with a decorator
- flexget.event.fire_event(name: str, *args, **kwargs) Any ¶
Trigger an event with name. If event is not hooked by anything nothing happens. If a function that hooks an event returns a value, it will replace the first argument when calling next function.
- Parameters:
name – Name of event to be called
args – List of arguments passed to handler function
kwargs – Key Value arguments passed to handler function
- flexget.event.get_events(name: str) List[Event] ¶
- Parameters:
name (String) – event name
- Returns:
List of
Event
for name ordered by priority
ipc
Module¶
- class flexget.ipc.ClientService¶
Bases:
Service
- exposed_console(text, *args, **kwargs)¶
- exposed_log_sink(message)¶
- exposed_version()¶
- on_connect(conn)¶
called when the connection is established
- class flexget.ipc.DaemonService¶
Bases:
Service
- client_log_sink(message)¶
- property client_out_stream¶
- exposed_handle_cli(args)¶
- exposed_version()¶
- manager = None¶
- on_connect(conn)¶
called when the connection is established
logger
Module¶
manager
Module¶
- class flexget.manager.Manager(args: List[str])¶
Bases:
object
Manager class for FlexGet
Fires events:
manager.initialize
The first time the manager is initialized, before config is loaded
manager.before_config_load
Before the config file is loaded from disk
manager.before_config_validate
When updating the config, before the validator is run on it
manager.config_updated
After a configuration file has been loaded or changed (and validated) this event is fired
manager.startup
After manager has been initialized. This is when application becomes ready to use, however no database lock is present, so the database must not be modified on this event.
manager.lock_acquired
The manager does not always require a lock on startup, if one is requested, this event will run when it has been acquired successfully
manager.upgrade
If any plugins have declared a newer schema version than exists in the database, this event will be fired to allow plugins to upgrade their tables
manager.shutdown_requested
When shutdown has been requested. Any plugins which might add to execution queue should stop when this is fired.
manager.shutdown
When the manager is exiting
manager.execute.completed
If execution in current process was completed
manager.daemon.started
manager.daemon.completed
manager.db_cleanup
- acquire_lock(event: bool = True) Iterator ¶
- Parameters:
event (bool) – If True, the ‘manager.lock_acquired’ event will be fired after a lock is obtained
- check_ipc_info() dict | None ¶
If a daemon has a lock on the database, return info to connect to IPC.
- config_changed() None ¶
Makes sure that all tasks will have the config_modified flag come out true on the next run. Useful when changing the db and all tasks need to be completely reprocessed.
- crash_report() str ¶
This should be called when handling an unexpected exception. Will create a new log file containing the last 50 debug messages as well as the crash traceback.
- daemon_command(options: Namespace) None ¶
Handles the ‘daemon’ CLI command.
Fires events:
manager.daemon.started
manager.daemon.completed
- Parameters:
options – argparse options
- db_cleanup(force: bool = False) None ¶
Perform database cleanup if cleanup interval has been met.
Fires events:
manager.db_cleanup
If interval was met. Gives session to do the cleanup as a parameter.
- Parameters:
force (bool) – Run the cleanup no matter whether the interval has been met.
- execute(options: dict | Namespace | None = None, priority: int = 1, suppress_warnings: Sequence[str] | None = None) List[Tuple[str, str, Event]] ¶
Run all (can be limited with options) tasks from the config.
- Parameters:
options – Either an
argparse.Namespace
instance, or a dict, containing options for executionpriority – If there are other executions waiting to be run, they will be run in priority order, lowest first.
suppress_warnings – Allows suppressing log warning about missing plugin in key phases
- Returns:
a list of
threading.Event
instances which will be set when each respective task has finished running
- execute_command(options: Namespace) None ¶
Handles the ‘execute’ CLI command.
If there is already a task queue running in this process, adds the execution to the queue. If FlexGet is being invoked with this command, starts up a task queue and runs the execution.
Fires events:
manager.execute.started
manager.execute.completed
- Parameters:
options – argparse options
- handle_cli(options: Namespace | None = None) None ¶
Dispatch a cli command to the appropriate function.
CLI plugin callback function
The manager should have a lock and be initialized before calling this method.
- Parameters:
options – argparse options for command. Defaults to options that manager was instantiated with.
- initialize() None ¶
Load plugins, database, and config. Also initializes (but does not start) the task queue and ipc server. This should only be called after obtaining a lock.
- load_config(output_to_console: bool = True, config_file_hash: str | None = None) None ¶
Loads the config file from disk, validates and activates it.
- Raises:
ValueError if there is a problem loading the config file
- static parse_initial_options(args: List[str]) Namespace ¶
Parse what we can from cli args before plugins are loaded.
- shutdown(finish_queue: bool = True) None ¶
Request manager shutdown.
- Parameters:
finish_queue (bool) – Should scheduler finish the task queue
- start() None ¶
Starting point when executing from commandline, dispatch execution to correct destination.
If there is a FlexGet process with an ipc server already running, the command will be sent there for execution and results will be streamed back. If not, this will attempt to obtain a lock, initialize the manager, and run the command here.
- unit_test = False¶
- update_config(config: dict) None ¶
Provide a new config for the manager to use.
- Raises:
ValueError and rolls back to previous config if the provided config is not valid.
- validate_config(config: dict | None = None) dict ¶
Check all root level keywords are valid. Config may be modified by before_config_validate hooks. Modified config will be returned.
- Parameters:
config – Config to check. If not provided, current manager config will be checked.
- Raises:
ValueError when config fails validation. There will be an errors attribute with the schema errors.
- Returns:
Final validated config.
options
Module¶
- class flexget.options.ArgumentParser(**kwargs)¶
Bases:
ArgumentParser
Mimics the default
argparse.ArgumentParser
class, with a few distinctions, mostly to ease subparser usage:If add_subparsers is called with the nested_namespaces kwarg, all subcommand options will be stored in a nested namespace based on the command name for the subparser
Adds the add_subparser method. After add_subparsers has been called, the add_subparser method can be used instead of the add_parser method of the object returned by the add_subparsers call.
add_subparser takes takes the parent_defaults argument, which will set/change the defaults for the parent parser when that subparser is selected.
The get_subparser method will get the
ArgumentParser
instance for an existing subparser on this parserFor any arguments defined both in this parser and one of its subparsers, the selected subparser default will override the main one.
Adds the set_post_defaults method. This works like the normal argparse set_defaults method, but all actions and subparsers will be run before any of these defaults are set.
Command shortening: If the command for a subparser is abbreviated unambiguously, it will still be accepted.
The add_argument nargs keyword argument supports a range of arguments, e.g. `”2-4”
If the raise_errors keyword argument to parse_args is True, a ParserError will be raised instead of sys.exit
If the file argument is given to parse_args, output will be printed there instead of sys.stdout or stderr
- add_argument(dest, ..., name=value, ...)¶
- add_argument(option_string, option_string, ..., name=value, ...) None
- add_subparser(name: str, **kwargs)¶
Adds a parser for a new subcommand and returns it.
- Parameters:
name – Name of the subcommand
parent_defaults – Default argument values which should be supplied to the parent parser if this subparser is selected.
- add_subparsers(**kwargs)¶
- Parameters:
nested_namespaces – If True, options from subparsers will appear in nested namespace under the subparser name.
- do_help = True¶
- error(message: string)¶
Prints a usage message incorporating the message to stderr and exits.
If you override this in a subclass, it should not return – it should either exit or raise an exception.
- get_subparser(name: str, default=<object object>)¶
- parse_args(args: List[str] | None = None, namespace: Namespace | None = None, raise_errors: bool = False, file: TextIO | None = None)¶
- Parameters:
raise_errors – If this is true, errors will be raised as `ParserError`s instead of calling sys.exit
- parse_known_args(args: List[str] | None = None, namespace: Namespace | None = None, do_help: bool | None = None)¶
- set_post_defaults(**kwargs)¶
Like set_defaults method, but these defaults will be defined after parsing instead of before.
- class flexget.options.CoreArgumentParser(**kwargs)¶
Bases:
ArgumentParser
The core argument parser, contains the manager arguments, command parsers, and plugin arguments.
Warning: Only gets plugin arguments if instantiated after plugins have been loaded.
- add_subparsers(**kwargs)¶
- Parameters:
nested_namespaces – If True, options from subparsers will appear in nested namespace under the subparser name.
- class flexget.options.CronAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶
Bases:
Action
- class flexget.options.DebugAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶
Bases:
Action
- class flexget.options.DebugTraceAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶
Bases:
Action
- class flexget.options.HelpAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶
Bases:
Action
Override the default help command so that we can conditionally disable it to prevent program exit.
- class flexget.options.InjectAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶
Bases:
Action
- class flexget.options.NestedSubparserAction(*args, **kwargs)¶
Bases:
_SubParsersAction
- class flexget.options.ParseExtrasAction(option_strings, parser, help=None, metavar=None, dest=None, required=False)¶
Bases:
Action
This action will take extra arguments, and parser them with a different parser.
- exception flexget.options.ParserError(message, parser)¶
Bases:
Exception
- class flexget.options.VersionAction(option_strings, version=None, dest='==SUPPRESS==', default='==SUPPRESS==', help="show program's version number and exit")¶
Bases:
_VersionAction
Action to print the current version. Also checks latest release revision.
- flexget.options.get_parser(command: str | None = None) ArgumentParser ¶
- flexget.options.register_command(command: str, callback: Callable[[Manager, Namespace], Any], **kwargs) ArgumentParser ¶
Register a callback function to be executed when flexget is launched with the given command.
- Parameters:
command – The command being defined.
callback – Callback function executed when this command is invoked from the CLI. Should take manager instance and parsed argparse namespace as parameters.
kwargs – Other keyword arguments will be passed to the
arparse.ArgumentParser
constructor
- Returns:
An
argparse.ArgumentParser
instance ready to be configured with the options for this command.
plugin
Module¶
- exception flexget.plugin.DependencyError(issued_by: str | None = None, missing: str | None = None, message: str | None = None, silent: bool = False)¶
Bases:
Exception
Plugin depends on other plugin, but it cannot be loaded.
- Args:
issued_by: name of the plugin trying to do the import missing: name of the plugin or library that is missing message: customized user readable error message
All args are optional.
- exception flexget.plugin.PluginError(value, logger: loguru.Logger = <loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>, **kwargs)¶
Bases:
Exception
- class flexget.plugin.PluginInfo(plugin_class: type, name: str | None = None, interfaces: List[str] | None = None, builtin: bool = False, debug: bool = False, api_ver: int = 1, category: str | None = None)¶
Bases:
dict
Allows accessing key/value pairs of this dictionary subclass via attributes. Also instantiates a plugin and initializes properties.
- dupe_counter = 0¶
- exception flexget.plugin.PluginWarning(value, logger: loguru.Logger = <loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>, **kwargs)¶
Bases:
Warning
- exception flexget.plugin.RegisterException(value)¶
Bases:
Exception
- flexget.plugin.get(name: str, requested_by: str | object) object ¶
- Parameters:
name (str) – Name of the requested plugin
requested_by – Plugin class instance OR string value who is making the request.
- Returns:
Instance of Plugin class
- flexget.plugin.get_plugin_by_name(name: str, issued_by: str = '???') PluginInfo ¶
Get plugin by name, preferred way since this structure may be changed at some point.
Getting plugin via .get function is recommended for normal use.
This results much shorter and cleaner code:
plugin.get_plugin_by_name('parsing').instance.parse_movie(data=entry['title'])
Shortens into:
plugin.get('parsing', self).parse_movie(data=entry['title'])
This function is still useful if you need to access plugin information (PluginInfo).
:returns PluginInfo instance
- flexget.plugin.get_plugins(phase: str | None = None, interface: str | None = None, category: str | None = None, name: str | None = None, min_api: int | None = None) Iterable[PluginInfo] ¶
Query other plugins characteristics.
- Parameters:
phase (string) – Require phase
interface (string) – Plugin must implement this interface.
category (string) – Type of plugin, phase names.
name (string) – Name of the plugin.
min_api (int) – Minimum api version.
- Returns:
List of PluginInfo instances.
- Return type:
list
- class flexget.plugin.internet(logger_: loguru.Logger = <loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>)¶
Bases:
object
@internet decorator for plugin phase methods.
Catches all internet related exceptions and raises PluginError with relevant message. Task handles PluginErrors by aborting the task.
- flexget.plugin.load_plugins(extra_plugins: List[str] | None = None, extra_components: List[str] | None = None) None ¶
Load plugins from the standard plugin and component paths.
- Parameters:
extra_plugins (list) – Extra directories from where plugins are loaded.
extra_components (list) – Extra directories from where components are loaded.
- flexget.plugin.plugin_schemas(**kwargs) Dict[str, Any] ¶
Create a dict schema that matches plugins specified by kwargs
- flexget.plugin.priority(value: int) Callable[[Callable], Callable] ¶
Priority decorator for phase methods
- flexget.plugin.register¶
alias of
PluginInfo
- flexget.plugin.register_schema()¶
task
Module¶
- class flexget.task.EntryContainer(iterable: list | None = None)¶
Bases:
list
Container for a list of entries, also contains accepted, rejected failed iterators over them.
- property accepted¶
- property entries¶
- property failed¶
- property rejected¶
- property undecided¶
- class flexget.task.EntryIterator(entries: List[Entry], states: EntryState | Iterable[EntryState])¶
Bases:
object
An iterator over a subset of entries to emulate old task.accepted/rejected/failed/entries properties.
- reverse()¶
- sort(*args, **kwargs)¶
- class flexget.task.Task(manager, name, config=None, options=None, output=None, session_id=None, priority=None, suppress_warnings=None)¶
Bases:
object
Represents one task in the configuration.
Fires events:
task.execute.before_plugin
Before a plugin is about to be executed. Note that since this will also include all builtin plugins the amount of calls can be quite high
parameters: task, keyword
task.execute.after_plugin
After a plugin has been executed.
parameters: task, keyword
task.execute.started
Before a task starts execution
task.execute.completed
After task execution has been completed
parameters: task
- RERUN_DEFAULT = 5¶
- RERUN_MAX = 100¶
- abort(reason='Unknown', silent=False, traceback: str | None = None)¶
Abort this task execution, no more plugins will be executed except the abort handling ones.
- property accepted¶
Deprecated since version Use: API v3
- property all_entries¶
Deprecated since version Use: API v3
- check_config_hash()¶
Checks the task’s config hash and updates the hash if necessary.
- config_changed()¶
Sets config_modified flag to True for the remainder of this run. Used when the db changes, and all entries need to be reprocessed.
- copy()¶
- disable_phase(phase)¶
Disable
phase
from execution.- Parameters:
phase (string) – Name of
phase
- Raises:
ValueError – phase could not be found.
- disable_plugin(plugin)¶
Disable
plugin
from execution.- Parameters:
plugin (string) – Name of
plugin
- Raises:
ValueError – plugin could not be found.
- property entries¶
Deprecated since version Use: API v3
- execute()¶
Executes the the task.
If
enabled
is False task is not executed. Certainoptions
affect how execution is handled.options.disable_phases
is a list of phases that are not enabled for this execution.options.inject
is a list ofEntry
instances used instead of running input phase.
- property failed¶
Deprecated since version Use: API v3
- find_entry(category='entries', **values)¶
Find and return
Entry
with given attributes from task or None- Parameters:
category (string) – entries, accepted, rejected or failed. Defaults to entries.
values – Key values of entries to be searched
- Returns:
Entry or None
- property is_rerun¶
- lock_reruns()¶
Prevent modification of max_reruns property
- property max_reruns¶
How many times task can be rerunned before stopping
- merge_config(new_config)¶
- plugins(phase=None)¶
Get currently enabled plugins.
- Parameters:
phase (string) – Optional, limits to plugins currently configured on given phase, sorted in phase order.
- Returns:
An iterator over configured
flexget.plugin.PluginInfo
instances enabled on this task.
- property rejected¶
Deprecated since version Use: API v3
- render(template)¶
Renders a template string based on fields in the entry.
- Parameters:
template – A template string or FlexGetTemplate that uses jinja2 or python string replacement format.
- Returns:
The result of the rendering.
- Return type:
string
- Raises:
RenderError – If there is a problem.
- rerun(plugin=None, reason=None)¶
Immediately re-run the task after execute has completed, task can be re-run up to
max_reruns
times.
- property rerun_count¶
- property reruns_locked¶
- property undecided¶
Deprecated since version Use: API v3
Note
We did not migrate to v3
If I remember correctly the idea was to make v3 signature on_task_xxx(task, config, entries)
Param entries would be EntryContainer, which has convenience iterator methods:
entries.accepted
entries.failed
etc, which you see here
- unlock_reruns()¶
Allow modification of max_reruns property
- static validate_config(config)¶
- class flexget.task.TaskConfigHash(**kwargs)¶
Bases:
VersionedBase
Stores the config hash for tasks so that we can tell if the config has changed since last run.
- hash¶
- id¶
- task¶
- flexget.task.register_config_key()¶
- flexget.task.use_task_logging(func)¶
task_queue
Module¶
- class flexget.task_queue.TaskQueue¶
Bases:
object
Task processing thread.
Only executes one task at a time, if more are requested they are queued up and run in turn.
webserver
Module¶
- class flexget.webserver.User(**kwargs)¶
Bases:
Base
,UserMixin
User class available for flask apps to handle authentication using flask_login
- get_id()¶
- id¶
- name¶
- password¶
- token¶
- exception flexget.webserver.WeakPassword(value, logger=<loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>, **kwargs)¶
Bases:
Exception
- class flexget.webserver.WebSecret(**kwargs)¶
Bases:
Base
Store flask secret in the database
- id¶
- value¶
- class flexget.webserver.WebServer(bind='0.0.0.0', port=5050, ssl_certificate=None, ssl_private_key=None, base_url='')¶
Bases:
Thread
- run()¶
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- start()¶
Start the thread’s activity.
It must be called at most once per thread object. It arranges for the object’s run() method to be invoked in a separate thread of control.
This method will raise a RuntimeError if called more than once on the same thread object.
- stop()¶
- triggers_lock = <unlocked _thread.lock object>¶
- flexget.webserver.generate_key()¶
Generate key for use to authentication
- flexget.webserver.get_random_string(length=12, allowed_chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')¶
Returns a securely generated random string.
The default length of 12 with the a-z, A-Z, 0-9 character set returns a 71-bit value. log_2((26+26+10)^12) =~ 71 bits.
Taken from the django.utils.crypto module.
- flexget.webserver.register_app(path, application, name)¶
- flexget.webserver.register_home(route)¶
Registers UI home page
- flexget.webserver.setup_server(config)¶
Sets up and starts/restarts the web service.
- flexget.webserver.start_page()¶
Redirect user to registered UI home
validator
Module¶
Deprecated since version 1.1: Use config_schema
instead
Subpackages¶
- utils Package
bittorrent
ModuleTorrent
Torrent.KEY_TYPE
Torrent.add_multitracker()
Torrent.comment
Torrent.encode()
Torrent.from_file()
Torrent.get_filelist()
Torrent.info_hash
Torrent.is_multi_file
Torrent.libtorrent_resume
Torrent.name
Torrent.piece_size
Torrent.private
Torrent.remove_multitracker()
Torrent.set_libtorrent_resume()
Torrent.size
Torrent.trackers
bdecode()
bencode()
clean_meta()
decode_item()
encode_bytes()
encode_dictionary()
encode_integer()
encode_list()
encode_string()
is_torrent_file()
tokenize()
cached_input
Moduledatabase
Moduleimdb
Modulelog
Modulequalities
Modulerequests
Modulesearch
Modulesimple_persistence
Modulesoup
Modulesqlalchemy_utils
Moduletemplate
ModuleFlexGetEnvironment
FlexGetNativeTemplate
FlexGetTemplate
RenderError
evaluate_expression()
extra_vars()
filter_asciify()
filter_d()
filter_date_suffix()
filter_default()
filter_format_number()
filter_format_size()
filter_formatdate()
filter_get_year()
filter_pad()
filter_parse_size()
filter_parsedate()
filter_pathbase()
filter_pathdir()
filter_pathext()
filter_pathname()
filter_pathscrub()
filter_re_replace()
filter_re_search()
filter_strip_symbols()
filter_strip_year()
filter_to_date()
get_filters()
get_template()
is_fs_dir()
is_fs_file()
is_fs_link()
list_templates()
make_environment()
render()
render_from_entry()
render_from_task()
tools
ModuleBufferQueue
MergeException
ReList
TimedDict
TitleYear
aggregate_inputs()
chunked()
decode_html()
encode_html()
format_filesize()
get_config_as_array()
get_config_hash()
get_current_flexget_version()
get_latest_flexget_version_number()
group_entries()
merge_dict_from_to()
multiply_timedelta()
parse_episode_identifier()
parse_filesize()
parse_timedelta()
pid_exists()
split_title_year()
str_to_boolean()
str_to_int()
strip_html()
- Subpackages