general_helper¶
-
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 : any
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_typeis 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_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 : any
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 : any
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 : any
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: - bool
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 : str
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 : any
The item to update the Themerr data file for.
- new_themerr_data : dict
The Themerr data to update the Themerr data file with.