mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-14 17:22:53 -07:00
Refactor PLEX*
This commit is contained in:
parent
182a542bda
commit
d2346b0ea6
2 changed files with 21 additions and 21 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue