webapp

Code.webapp.cache_data()[source]

Cache data for use in the Web UI dashboard.

Because there are many http requests that must be made to gather the data for the dashboard, it can be time-consuming to populate; therefore, this is performed within this caching function, which runs on a schedule. This function will create a json file that can be loaded by other functions.

Code.webapp.get_locale()[source]

Get the locale from the config.

Get the locale specified in the config. This does not need to be called as it is done so automatically by babel.

Returns:
str

The locale.

Examples

>>> get_locale()
en
Code.webapp.home()[source]

Serve the webapp home page.

This page serves the Themerr completion report for supported Plex libraries.

Returns:
render_template

The rendered page.

Notes

The following routes trigger this function.

  • /
  • /home

Examples

>>> home()
Code.webapp.image(img)[source]

Get image from static/images directory.

Returns:
flask.send_from_directory

The image.

Notes

The following routes trigger this function.

  • /favicon.ico

Examples

>>> image('favicon.ico')
Code.webapp.start_server()[source]

Start the flask server.

The flask server is started in a separate thread to allow the plugin to continue running.

Returns:
pybool

True if the server is running, otherwise False.

See also

Core.Start
Function that starts the plugin.
stop_server
Function that stops the webapp.

Examples

>>> start_server()
Code.webapp.status()[source]

Check the status of Themerr-plex.

This can be used to test if the plugin is still running. It could be used as part of a healthcheck for Docker, and may have many other uses in the future.

Returns:
dict

A dictionary of the status.

Examples

>>> status()
Code.webapp.stop_server()[source]

Stop the web server.

This method currently does nothing.

Returns:
pybool

True if the server was shutdown, otherwise False.

See also

start_server
Function that starts the webapp.

Examples

>>> stop_server()
Code.webapp.translations()[source]

Serve the translations.

Returns:
Response

The translations.

Examples

>>> translations()