From 57cb5ff6cfffd1b81b72355548365ae1e0130a40 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Wed, 6 Apr 2016 19:23:59 -0700 Subject: [PATCH] Fix fallback pms_url if server URL not found --- plexpy/plextv.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plexpy/plextv.py b/plexpy/plextv.py index 9d7d1ed8..39b02307 100644 --- a/plexpy/plextv.py +++ b/plexpy/plextv.py @@ -80,17 +80,22 @@ def get_real_pms_url(): process_urls = False if process_urls: + found_url = False + if result: for item in result: if plexpy.CONFIG.PMS_IS_REMOTE and item['local'] == '0': + found_url = True plexpy.CONFIG.__setattr__('PMS_URL', item['uri']) plexpy.CONFIG.write() logger.info(u"PlexPy PlexTV :: Server URL retrieved.") if not plexpy.CONFIG.PMS_IS_REMOTE and item['local'] == '1' and 'plex.direct' in item['uri']: + found_url = True plexpy.CONFIG.__setattr__('PMS_URL', item['uri']) plexpy.CONFIG.write() logger.info(u"PlexPy PlexTV :: Server URL retrieved.") - else: + + if not found_url: plexpy.CONFIG.__setattr__('PMS_URL', fallback_url) plexpy.CONFIG.write() logger.warn(u"PlexPy PlexTV :: Unable to retrieve server URLs. Using user-defined value.")