flexget.components.irc.irc module#

exception flexget.components.irc.irc.MissingConfigOption[source]#

Bases: Exception

Exception thrown when a config option specified in the tracker file is not on the irc config.

exception flexget.components.irc.irc.TrackerFileError[source]#

Bases: Exception

Exception thrown when parsing the tracker file fails.

exception flexget.components.irc.irc.TrackerFileParseError[source]#

Bases: Exception

Exception thrown when parsing the tracker file fails.

class flexget.components.irc.irc.IRCConnection(config, config_name)[source]#

Bases: object

classmethod read_tracker_config(path)[source]#

Attempt to open and parse the .tracker file specified in path.

Parameters:

path – path to .tracker file

Returns:

the parsed XML

classmethod retrieve_tracker_config(tracker_config_file)[source]#

Attempt to retrieve the .tracker file from disk or github. Return the parsed XML.

Parameters:

tracker_config_file – URL or path to .tracker file

Returns:

parsed XML

entries_from_linepatterns(lines)[source]#

Return list of entries generated from lines.

Parameters:

lines – list of lines from irc

Return type:

list

entries_from_lines(lines)[source]#

Return list of entries generated from lines.

Parameters:

lines – list of lines

Return type:

list

entries_from_multilinepatterns(lines)[source]#

Return list of entries generated from lines.

Parameters:

lines – list of lines

Return type:

list

is_alive()[source]#
is_connected()[source]#
match_message_patterns(patterns, msg)[source]#

Try to match the message to the list of patterns. Support multiline messages.

Parameters:
  • patterns – list of (regex, variable)-pairs

  • msg – The parsed IRC message

  • multiline – True if msg is multiline

Returns:

A dict of the variables and their extracted values

on_privmsg(msg)[source]#

Append messages for the specific channel in the line cache.

Schedule a message processing after 1s to handle multiline announcements. :param msg: IRCMessage object :return:

parse_patterns(patterns)[source]#

Parse the patterns and create a tuple with the compiled regex pattern and the variables it produces.

Parameters:

patterns – list of regex patterns as .tracker XML

Returns:

list of (regex, variables, optional)-pairs

process_message(nickname, channel)[source]#

Pop lines from the line cache and pass them to be parsed.

Parameters:
  • nickname (str) – Nickname of who sent the message

  • channel (str) – Channel where the message originated from

Returns:

None

process_tracker_config_rules(entry, rules=None)[source]#

Process an Entry object with the linematched rules defined in a tracker config file.

Parameters:
  • entry – Entry to be updated

  • rules – Ruleset to use.

Returns:

queue_entry(entry)[source]#

Store an entry in the connection entry queue, if the queue is over the size limit then submit them.

Parameters:

entry – Entry to be queued

Returns:

quit()[source]#

Quit the IRC bot.

Returns:

run_tasks()[source]#

Pass entries to the target task(s) configured for this connection.

Returns:

stop(wait)[source]#
class flexget.components.irc.irc.IRCConnectionManager(config)[source]#

Bases: object

is_alive()[source]#
restart_connection(name, config=None)[source]#
restart_connections(name=None)[source]#
start()[source]#

Check for dead threads and attempt to restart them.

If the connection appears to be throttled, it won’t attempt to reconnect for 30s. :return:

start_connections()[source]#

Start all the irc connections. Stop the daemon if there are failures.

Returns:

status(name=None)[source]#
status_dict(name)[source]#
stop(wait)[source]#
stop_connection(name, wait=False)[source]#
stop_connections(wait, name=None)[source]#
update_config(config)[source]#
flexget.components.irc.irc.create_thread(name, conn)[source]#

Create a new thread and start it.

Parameters:

conn – IRCConnection or IRCConnectionManager object

Returns:

Thread

flexget.components.irc.irc.irc_prefix(var)[source]#

Prefix a string with irc_.

Parameters:

var – Variable to prefix

Returns:

Prefixed variable

flexget.components.irc.irc.irc_start(manager)[source]#
flexget.components.irc.irc.irc_update_config(manager)[source]#
flexget.components.irc.irc.register_plugin()[source]#
flexget.components.irc.irc.shutdown_requested(manager)[source]#
flexget.components.irc.irc.stop_irc(manager, wait=False)[source]#
flexget.components.irc.irc.strip_whitespace(value)[source]#

Remove leading and trailing whitespace from strings. Return value if not a string.

Parameters:

value

Returns:

stripped string or value