Refactor PLEX*

This commit is contained in:
Labrys of Knossos 2019-01-19 00:13:13 -05:00
parent 182a542bda
commit d2346b0ea6
2 changed files with 21 additions and 21 deletions

View file

@ -8,20 +8,20 @@ def plex_update(category):
if core.FAILED:
return
url = '{scheme}://{host}:{port}/library/sections/'.format(
scheme='https' if core.PLEXSSL else 'http',
host=core.PLEXHOST,
port=core.PLEXPORT,
scheme='https' if core.PLEX_SSL else 'http',
host=core.PLEX_HOST,
port=core.PLEX_PORT,
)
section = None
if not core.PLEXSEC:
if not core.PLEX_SECTION:
return
logger.debug('Attempting to update Plex Library for category {0}.'.format(category), 'PLEX')
for item in core.PLEXSEC:
for item in core.PLEX_SECTION:
if item[0] == category:
section = item[1]
if section:
url = '{url}{section}/refresh?X-Plex-Token={token}'.format(url=url, section=section, token=core.PLEXTOKEN)
url = '{url}{section}/refresh?X-Plex-Token={token}'.format(url=url, section=section, token=core.PLEX_TOKEN)
requests.get(url, timeout=(60, 120), verify=False)
logger.debug('Plex Library has been refreshed.', 'PLEX')
else: