Allow manual PMS URL override in config file for XML shortcuts

This commit is contained in:
JonnyWong16 2018-06-02 09:55:39 -07:00
parent 50c5407a46
commit 668913fd60
2 changed files with 11 additions and 1 deletions

View file

@ -276,9 +276,18 @@ class WebInterface(object):
@requireAuth(member_of("admin"))
def return_plex_xml_url(self, endpoint='', plextv=False, **kwargs):
kwargs['X-Plex-Token'] = plexpy.CONFIG.PMS_TOKEN
base_url = 'https://plex.tv' if plextv else plexpy.CONFIG.PMS_URL
if plextv:
base_url = 'https://plex.tv'
else:
if plexpy.CONFIG.PMS_URL_OVERRIDE:
base_url = plexpy.CONFIG.PMS_URL_OVERRIDE
else:
base_url = plexpy.CONFIG.PMS_URL
if '{machine_id}' in endpoint:
endpoint = endpoint.format(machine_id=plexpy.CONFIG.PMS_IDENTIFIER)
return base_url + endpoint + '?' + urllib.urlencode(kwargs)
@cherrypy.expose