__init__

Code.Start()[source]

Start the plug-in.

This function is called when the plug-in first starts. It can be used to perform extra initialisation tasks such as configuring the environment and setting default attributes. See the archived Plex documentation Predefined functions for more information.

Preferences are validated, then additional threads are started for the web server, queue, plex listener, and scheduled tasks.

Examples

>>> Start()
...
class Code.Themerr(*args, **kwargs)[source]

Bases: object

Class representing the Themerr-plex Agent.

This class defines the metadata agent. See the archived Plex documentation Defining an agent class for more information.

References

name : str
A string defining the name of the agent for display in the GUI.
languages : list
A list of strings defining the languages supported by the agent. These values should be taken from the constants defined in the Locale API.
primary_provider : py:class:bool
A boolean value defining whether the agent is a primary metadata provider or not. Primary providers can be selected as the main source of metadata for a particular media type. If an agent is secondary (primary_provider is set to False) it will only be able to contribute to data provided by another primary agent.
fallback_agent : Optional[str]
A string containing the identifier of another agent to use as a fallback. If none of the matches returned by an agent are a close enough match to the given set of hints, this fallback agent will be called to attempt to find a better match.
accepts_from : Optional[list]
A list of strings containing the identifiers of agents that can contribute secondary data to primary data provided by this agent.
contributes_to : Optional[list]
A list of strings containing the identifiers of primary agents that the agent can contribute secondary data to.

Examples

>>> Themerr()
...

Methods

search: Search for an item.
update: Add or update metadata for an item.
search(self, results, media, lang, manual)[source]

Search for an item.

When the media server needs an agent to perform a search, it calls the agent’s search method. See the archived Plex documentation Searching for results to provide matches for media for more information.

Parameters:
results : SearchResult

An empty container that the developer should populate with potential matches.

media : Union[Media.Movie, Media.TV_Show]

An object containing hints to be used when performing the search.

lang : str

A string identifying the user’s currently selected language. This will be one of the constants added to the agent’s languages attribute.

manual : pybool

A boolean value identifying whether the search was issued automatically during scanning, or manually by the user (in order to fix an incorrect match).

Returns:
Optional[SearchResult]

The search result object, if the search was successful.

Examples

>>> Themerr().search(results=..., media=..., lang='en', manual=True)
...
static update(metadata, media, lang, force)[source]

Update metadata for an item.

Once an item has been successfully matched, it is added to the update queue. As the framework processes queued items, it calls the update method of the relevant agents. See the archived Plex documentation Adding metadata to media for more information.

Parameters:
metadata : MetadataModel

A pre-initialized metadata object if this is the first time the item is being updated, or the existing metadata object if the item is being refreshed.

media : Union[Media.Movie, Media.TV_Show]

An object containing information about the media hierarchy in the database.

lang : str

A string identifying which language should be used for the metadata. This will be one of the constants defined in the agent’s languages attribute.

force : pybool

A boolean value identifying whether the user forced a full refresh of the metadata. If this argument is True, all metadata should be refreshed, regardless of whether it has been populated previously.

Returns:
MetadataModel

The metadata object.

Examples

>>> Themerr().update(metadata=..., media=..., lang='en', force=True)
...
class Code.ThemerrMovies(*args, **kwargs)[source]

Bases: Code.Themerr, plexhints.agent_kit.Movies

class Code.ThemerrTvShows(*args, **kwargs)[source]

Bases: Code.Themerr, plexhints.agent_kit.TV_Shows

Code.ValidatePrefs()[source]

Validate plug-in preferences.

This function is called when the user modifies their preferences. The developer can check the newly provided values to ensure they are correct (e.g. attempting a login to validate a username and password), and optionally return a MessageContainer to display any error information to the user. See the archived Plex documentation Predefined functions for more information.

Returns:
MessageContainer

Success or Error message dependeing on results of validation.

Examples

>>> ValidatePrefs()
...
Code.copy_prefs()[source]

Copy the current preferences to the last preferences.

This function is used to copy the current preferences to the last preferences. This is useful to determine if the preferences have changed.

Examples

>>> copy_prefs()