__init__

class Code.RetroArcher[source]

Bases: plexhints.agent_kit.Movies

Class representing the RetroArcher Plex Movie 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 : 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

>>> RetroArcher()
...
Attributes:
contributes_to

Methods

search: Search for an item.
update: Add or update metadata for an item.
static search(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 : Media.Movie

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 : bool

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

>>> RetroArcher().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 : object

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 : object

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 : bool

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.

Examples

>>> RetroArcher().update(metadata=..., media=..., lang='en', force=True)
...
Code.SetRating(key, rating)[source]

This function is called when the user sets the rating of a metadata item returned by the plug-in. The key argument will be equal to the value of the item’s rating_key attribute. See the archived Plex documentation Predefined functions for more information.

Parameters:
key : str

This will be equal to the value of the item’s rating_key attribute.

rating : float

A float between 0 and 10 specifying the item’s rating.

Examples

>>> SetRating(key='123456', rating=8.8)
...
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.

Examples

>>> Start()
...
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()
...