/
/
/
1"""Constants for the Plex Music Provider."""
2
3from __future__ import annotations
4
5CONF_ACTION_AUTH_MYPLEX = "auth_myplex"
6CONF_ACTION_AUTH_LOCAL = "auth_local"
7CONF_ACTION_CLEAR_AUTH = "auth"
8CONF_ACTION_LIBRARY = "library"
9CONF_ACTION_GDM = "gdm"
10
11CONF_AUTH_TOKEN = "token"
12CONF_LIBRARY_ID = "library_id"
13CONF_LOCAL_SERVER_IP = "local_server_ip"
14CONF_LOCAL_SERVER_PORT = "local_server_port"
15CONF_LOCAL_SERVER_SSL = "local_server_ssl"
16CONF_LOCAL_SERVER_VERIFY_CERT = "local_server_verify_cert"
17CONF_IMPORT_COLLECTIONS = "import_collections"
18CONF_COLLECTION_PREFIX = "collection_prefix"
19CONF_PLEX_LIKE_RATING = "plex_like_rating"
20CONF_PLEX_FAVORITE_THRESHOLD = "plex_favorite_threshold"
21CONF_PLEX_UNLIKE_RATING = "plex_unlike_rating"
22CONF_HUB_ITEMS_LIMIT = "hub_items_limit"
23CONF_EXTENDED_RECOMMENDATIONS = "extended_recommendations"
24
25FAKE_ARTIST_PREFIX = "_fake://"
26
27# maximum number of tracks returned for an artist's top tracks listing
28MAX_TOP_TRACKS = 25
29
30# sentinel token value for local (unauthenticated) connections, not via plex.tv
31AUTH_TOKEN_UNAUTH = "local_auth"
32
33# item_id prefix used for Plex collections imported as playlists
34COLLECTION_ID_PREFIX = "collection:"
35
36# item_id prefix used for Plex "Mixes For You" playlists
37MIX_ITEM_PREFIX = "mix:"
38
39# Mix title/artwork are cached so replay from recently-played survives Plex
40# rotating the mix out of its hub. 90 days is chosen to outlive MA's
41# playlog retention (see controllers/music.py: _cleanup_database).
42MIX_CACHE_EXPIRATION = 86400 * 90
43
44# Query parameters passed to /hubs/sections when loading recommendations.
45# Some of these are not in public Plex docs but are required to surface
46# the "Mixes For You" hub and library playlists.
47RECOMMENDATIONS_HUB_PARAMS = (
48 "includeMyMixes=1"
49 "&includeStations=1"
50 "&includeLibraryPlaylists=1"
51 "&includeExternalMetadata=1"
52 "&includeAnniversaryReleases=1"
53 "&excludeElements=Similar,Mood"
54 "&excludeFields=summary"
55)
56
57# error messages (templates use str.format)
58ERR_INVALID_CREDENTIALS = "Invalid login credentials"
59ERR_AUTH_FAILED = "Authentication failed"
60ERR_MYPLEX_AUTH_FAILED = "Authentication to MyPlex failed"
61ERR_MYPLEX_TOKEN_NOT_RECEIVED = "Authentication to MyPlex failed: token not received"
62ERR_NO_LIBRARIES = "Unable to retrieve Servers and/or Music Libraries"
63ERR_ITEM_NOT_FOUND = "Item {item_id} not found"
64ERR_ARTIST_NOT_FOUND = "Artist not found: {item_id}"
65ERR_TRACK_NOT_FOUND = "Track {item_id} not found"
66ERR_ARTIST_INVALID_ID = "Artist does not have a valid ID"
67ERR_NO_ARTIST_FOR_TRACK = "No artist was found for track"
68