general_helper

Code.general_helper.agent_enabled(item_agent, item_type)[source]

Check if the specified agent is enabled.

Parameters:
item_agent : str

The agent to check.

item_type : str

The type of the item to check.

Returns:
pybool

True if the agent is enabled, False otherwise.

Examples

>>> agent_enabled(item_agent='com.plexapp.agents.imdb', item_type='movie')
True
>>> agent_enabled(item_agent='com.plexapp.agents.themoviedb', item_type='movie')
True
>>> agent_enabled(item_agent='com.plexapp.agents.themoviedb', item_type='show')
True
>>> agent_enabled(item_agent='com.plexapp.agents.thetvdb', item_type='show')
True
>>> agent_enabled(item_agent='dev.lizardbyte.retroarcher-plex', item_type='movie')
True
Code.general_helper.continue_update(item_agent, item_type)[source]

Check if the specified agent should continue updating.

Parameters:
item_agent : str

The agent to check.

item_type : str

The type of the item to check.

Returns:
pybool

True if the agent should continue updating, False otherwise.

Examples

>>> continue_update(item_agent='tv.plex.agents.movie', item_type='movie')
True
>>> continue_update(item_agent='tv.plex.agents.series', item_type='show')
True
>>> continue_update(item_agent='com.plexapp.agents.imdb', item_type='movie')
True
>>> continue_update(item_agent='com.plexapp.agents.themoviedb', item_type='movie')
True
>>> continue_update(item_agent='com.plexapp.agents.themoviedb', item_type='show')
True
>>> continue_update(item_agent='com.plexapp.agents.thetvdb', item_type='show')
True
>>> continue_update(item_agent='dev.lizardbyte.retroarcher-plex', item_type='movie')
True
Code.general_helper.get_media_upload_path(item, media_type)[source]

Get the path to the theme upload directory.

Get the hashed path of the theme upload directory for the item specified by the item.

Parameters:
item : PlexPartialObject

The item to get the theme upload path for.

media_type : str

The media type to get the theme upload path for. Must be one of ‘art’, ‘posters’, or ‘themes’.

Returns:
str

The path to the theme upload directory.

Raises:
ValueError

If the media_type is not one of ‘art’, ‘posters’, or ‘themes’.

Examples

>>> get_media_upload_path(item=..., media_type='art')
"...bundle/Uploads/art..."
>>> get_media_upload_path(item=..., media_type='posters')
"...bundle/Uploads/posters..."
>>> get_media_upload_path(item=..., media_type='themes')
"...bundle/Uploads/themes..."
Code.general_helper.get_theme_provider(item)[source]

Get the theme provider.

Get the theme provider for the item specified by the item.

Parameters:
item : PlexPartialObject

The item to get the theme provider for.

Returns:
str

The theme provider.

Examples

>>> get_theme_provider(item=...)
...
Code.general_helper.get_themerr_json_data(item)[source]

Get the Themerr data for the specified item.

Themerr data is stored as a JSON file in the Themerr data directory, and is used to ensure that we don’t unnecessarily re-upload media to the Plex server.

Parameters:
item : PlexPartialObject

The item to get the Themerr data for.

Returns:
dict

The Themerr data for the specified item, or empty dict if no Themerr data exists.

Code.general_helper.get_themerr_json_path(item)[source]

Get the path to the Themerr data file.

Get the path to the Themerr data file for the item specified by the item.

Parameters:
item : PlexPartialObject

The item to get the Themerr data file path for.

Returns:
str

The path to the Themerr data file.

Examples

>>> get_themerr_json_path(item=...)
'.../Plex Media Server/Plug-in Support/Data/dev.lizardbyte.themerr-plex/DataItems/...'
Code.general_helper.get_themerr_settings_hash()[source]

Get a hash of the current Themerr settings.

Returns:
str

Hash of the current Themerr settings.

Examples

>>> get_themerr_settings_hash()
'...'
Code.general_helper.remove_uploaded_media(item, media_type)[source]

Remove themes for the specified item.

Deletes the themes upload directory for the item specified by the item.

Parameters:
item : PlexPartialObject

The item to remove the themes from.

media_type : str

The media type to remove the themes from. Must be one of ‘art’, ‘posters’, or ‘themes’.

Returns:
pybool

True if the themes were removed successfully, False otherwise.

Examples

>>> remove_uploaded_media(item=..., media_type='themes')
...
Code.general_helper.remove_uploaded_media_error_handler(func, path, exc_info)[source]

Error handler for removing themes.

Handles errors that occur when removing themes using shutil.

Parameters:
func : any

The function that caused the error.

path : any

The path that caused the error.

exc_info : any

The exception information.

Code.general_helper.update_themerr_data_file(item, new_themerr_data)[source]

Update the Themerr data file for the specified item.

This updates the themerr data file after uploading media to the Plex server.

Parameters:
item : PlexPartialObject

The item to update the Themerr data file for.

new_themerr_data : dict

The Themerr data to update the Themerr data file with.