Add X-Plex-Language header to config (#1241)

This commit is contained in:
JonnyWong16 2023-09-17 14:51:54 -07:00 committed by GitHub
parent fdc89c8acb
commit cbaaa196da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View file

@ -130,6 +130,10 @@ Section [header] Options
Header value used for X_PLEX_IDENTIFIER to all Plex server and Plex client requests. This is generally Header value used for X_PLEX_IDENTIFIER to all Plex server and Plex client requests. This is generally
a UUID, serial number, or other number unique id for the device (default: `result of hex(uuid.getnode())`). a UUID, serial number, or other number unique id for the device (default: `result of hex(uuid.getnode())`).
**language**
Header value used for X_PLEX_LANGUAGE to all Plex server and Plex client requests. This is an ISO 639-1
language code (default: en).
**platform** **platform**
Header value used for X_PLEX_PLATFORM to all Plex server and Plex client requests. Example platforms Header value used for X_PLEX_PLATFORM to all Plex server and Plex client requests. Example platforms
include: iOS, MacOSX, Android, LG (default: `result of platform.uname()[0]`). include: iOS, MacOSX, Android, LG (default: `result of platform.uname()[0]`).

View file

@ -30,6 +30,7 @@ X_PLEX_VERSION = CONFIG.get('header.version', VERSION)
X_PLEX_DEVICE = CONFIG.get('header.device', X_PLEX_PLATFORM) X_PLEX_DEVICE = CONFIG.get('header.device', X_PLEX_PLATFORM)
X_PLEX_DEVICE_NAME = CONFIG.get('header.device_name', uname()[1]) X_PLEX_DEVICE_NAME = CONFIG.get('header.device_name', uname()[1])
X_PLEX_IDENTIFIER = CONFIG.get('header.identifier', str(hex(getnode()))) X_PLEX_IDENTIFIER = CONFIG.get('header.identifier', str(hex(getnode())))
X_PLEX_LANGUAGE = CONFIG.get('header.language', 'en')
BASE_HEADERS = reset_base_headers() BASE_HEADERS = reset_base_headers()
# Logging Configuration # Logging Configuration

View file

@ -63,6 +63,7 @@ def reset_base_headers():
'X-Plex-Device': plexapi.X_PLEX_DEVICE, 'X-Plex-Device': plexapi.X_PLEX_DEVICE,
'X-Plex-Device-Name': plexapi.X_PLEX_DEVICE_NAME, 'X-Plex-Device-Name': plexapi.X_PLEX_DEVICE_NAME,
'X-Plex-Client-Identifier': plexapi.X_PLEX_IDENTIFIER, 'X-Plex-Client-Identifier': plexapi.X_PLEX_IDENTIFIER,
'X-Plex-Language': plexapi.X_PLEX_LANGUAGE,
'X-Plex-Sync-Version': '2', 'X-Plex-Sync-Version': '2',
'X-Plex-Features': 'external-media', 'X-Plex-Features': 'external-media',
} }