diff --git a/core/__init__.py b/core/__init__.py index 4acda833..c234fef3 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -169,11 +169,11 @@ QBITTORRENT_PORT = None QBITTORRENT_USER = None QBITTORRENT_PASSWORD = None -PLEXSSL = None -PLEXHOST = None -PLEXPORT = None -PLEXTOKEN = None -PLEXSEC = [] +PLEX_SSL = None +PLEX_HOST = None +PLEX_PORT = None +PLEX_TOKEN = None +PLEX_SECTION = [] EXTCONTAINER = [] COMPRESSEDCONTAINER = [] @@ -269,7 +269,7 @@ def initialize(section=None): DELETE_ORIGINAL, TORRENT_CHMOD_DIRECTORY, PASSWORDSFILE, USER_DELAY, USER_SCRIPT, USER_SCRIPT_CLEAN, USER_SCRIPT_MEDIAEXTENSIONS, \ USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO, CHECK_MEDIA, SAFE_MODE, \ TORRENT_DEFAULTDIR, TORRENT_RESUME_ON_FAILURE, NZB_DEFAULTDIR, REMOTEPATHS, LOG_ENV, PID_FILE, MYAPP, ACHANNELS, ACHANNELS2, ACHANNELS3, \ - PLEXSSL, PLEXHOST, PLEXPORT, PLEXTOKEN, PLEXSEC, TORRENT_RESUME, PAR2CMD, QBITTORRENT_HOST, QBITTORRENT_PORT, QBITTORRENT_USER, QBITTORRENT_PASSWORD + PLEX_SSL, PLEX_HOST, PLEX_PORT, PLEX_TOKEN, PLEX_SECTION, TORRENT_RESUME, PAR2CMD, QBITTORRENT_HOST, QBITTORRENT_PORT, QBITTORRENT_USER, QBITTORRENT_PASSWORD if __INITIALIZED__: return False @@ -434,15 +434,15 @@ def initialize(section=None): REMOTEPATHS = [(local.strip(), remote.strip()) for local, remote in REMOTEPATHS] # strip trailing and leading whitespaces - PLEXSSL = int(CFG['Plex']['plex_ssl']) - PLEXHOST = CFG['Plex']['plex_host'] - PLEXPORT = CFG['Plex']['plex_port'] - PLEXTOKEN = CFG['Plex']['plex_token'] - PLEXSEC = CFG['Plex']['plex_sections'] or [] - if PLEXSEC: - if isinstance(PLEXSEC, list): - PLEXSEC = ','.join(PLEXSEC) # fix in case this imported as list. - PLEXSEC = [tuple(item.split(',')) for item in PLEXSEC.split('|')] + PLEX_SSL = int(CFG['Plex']['plex_ssl']) + PLEX_HOST = CFG['Plex']['plex_host'] + PLEX_PORT = CFG['Plex']['plex_port'] + PLEX_TOKEN = CFG['Plex']['plex_token'] + PLEX_SECTION = CFG['Plex']['plex_sections'] or [] + if PLEX_SECTION: + if isinstance(PLEX_SECTION, list): + PLEX_SECTION = ','.join(PLEX_SECTION) # fix in case this imported as list. + PLEX_SECTION = [tuple(item.split(',')) for item in PLEX_SECTION.split('|')] devnull = open(os.devnull, 'w') try: diff --git a/core/utils/notifications.py b/core/utils/notifications.py index ed89f65b..ddad0c1b 100644 --- a/core/utils/notifications.py +++ b/core/utils/notifications.py @@ -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: