From b2ceefe975b859d224650bbca931f548a5847ea7 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Wed, 18 Jan 2023 09:47:24 -0800 Subject: [PATCH] Fallback to PlexAPI config for PLEX_URL and PLEX_TOKEN --- reporting/streaming_service_availability.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reporting/streaming_service_availability.py b/reporting/streaming_service_availability.py index 9379c9a..a291681 100644 --- a/reporting/streaming_service_availability.py +++ b/reporting/streaming_service_availability.py @@ -7,15 +7,16 @@ import argparse import os +from plexapi import CONFIG from plexapi.server import PlexServer from plexapi.exceptions import BadRequest PLEX_URL = '' PLEX_TOKEN = '' -# Environment Variables -PLEX_URL = os.getenv('PLEX_URL', PLEX_URL) -PLEX_TOKEN = os.getenv('PLEX_TOKEN', PLEX_TOKEN) +# Environment Variables or PlexAPI Config +PLEX_URL = os.getenv('PLEX_URL', PLEX_URL) or CONFIG.data['auth'].get('server_baseurl') +PLEX_TOKEN = os.getenv('PLEX_TOKEN', PLEX_TOKEN) or CONFIG.data['auth'].get('server_token') def check_streaming_services(plex, libraries, services, available_only):