From 2ebe96e04930088b5b99f822cf95b25f4a46d134 Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Sat, 19 Jan 2019 00:50:00 -0500 Subject: [PATCH] Refactor REMOTEPATHS -> REMOTE_PATHS --- core/__init__.py | 20 ++++++++++---------- core/utils/paths.py | 4 ++-- nzbToMedia.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/__init__.py b/core/__init__.py index 9ea59001..9c040377 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -148,7 +148,7 @@ TORRENT_DEFAULT_DIRECTORY = None TORRENT_RESUME = None TORRENT_RESUME_ON_FAILURE = None -REMOTEPATHS = [] +REMOTE_PATHS = [] UTORRENT_WEB_UI = None UTORRENT_USER = None @@ -268,7 +268,7 @@ def initialize(section=None): NICENESS, LOG_DEBUG, FORCE_CLEAN, FFMPEG_PATH, FFMPEG, FFPROBE, AUDIOCONTAINER, EXTCONTAINER, TORRENT_CLASS, \ 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_DEFAULT_DIRECTORY, TORRENT_RESUME_ON_FAILURE, NZB_DEFAULT_DIRECTORY, REMOTEPATHS, LOG_ENV, PID_FILE, MYAPP, ACHANNELS, ACHANNELS2, ACHANNELS3, \ + TORRENT_DEFAULT_DIRECTORY, TORRENT_RESUME_ON_FAILURE, NZB_DEFAULT_DIRECTORY, REMOTE_PATHS, LOG_ENV, PID_FILE, MYAPP, ACHANNELS, ACHANNELS2, ACHANNELS3, \ PLEX_SSL, PLEX_HOST, PLEX_PORT, PLEX_TOKEN, PLEX_SECTION, TORRENT_RESUME, PAR2CMD, QBITTORRENT_HOST, QBITTORRENT_PORT, QBITTORRENT_USER, QBITTORRENT_PASSWORD if __INITIALIZED__: @@ -425,14 +425,14 @@ def initialize(section=None): QBITTORRENT_USER = CFG['Torrent']['qBittorrentUSR'] # mysecretusr QBITTORRENT_PASSWORD = CFG['Torrent']['qBittorrentPWD'] # mysecretpwr - REMOTEPATHS = CFG['Network']['mount_points'] or [] - if REMOTEPATHS: - if isinstance(REMOTEPATHS, list): - REMOTEPATHS = ','.join(REMOTEPATHS) # fix in case this imported as list. - REMOTEPATHS = [tuple(item.split(',')) for item in - REMOTEPATHS.split('|')] # /volume1/Public/,E:\|/volume2/share/,\\NAS\ - REMOTEPATHS = [(local.strip(), remote.strip()) for local, remote in - REMOTEPATHS] # strip trailing and leading whitespaces + REMOTE_PATHS = CFG['Network']['mount_points'] or [] + if REMOTE_PATHS: + if isinstance(REMOTE_PATHS, list): + REMOTE_PATHS = ','.join(REMOTE_PATHS) # fix in case this imported as list. + REMOTE_PATHS = [tuple(item.split(',')) for item in + REMOTE_PATHS.split('|')] # /volume1/Public/,E:\|/volume2/share/,\\NAS\ + REMOTE_PATHS = [(local.strip(), remote.strip()) for local, remote in + REMOTE_PATHS] # strip trailing and leading whitespaces PLEX_SSL = int(CFG['Plex']['plex_ssl']) PLEX_HOST = CFG['Plex']['plex_host'] diff --git a/core/utils/paths.py b/core/utils/paths.py index ec99a246..dba119f5 100644 --- a/core/utils/paths.py +++ b/core/utils/paths.py @@ -48,9 +48,9 @@ def make_dir(path): def remote_dir(path): - if not core.REMOTEPATHS: + if not core.REMOTE_PATHS: return path - for local, remote in core.REMOTEPATHS: + for local, remote in core.REMOTE_PATHS: if local in path: base_dirs = path.replace(local, '').split(os.sep) if '/' in remote: diff --git a/nzbToMedia.py b/nzbToMedia.py index 526540d1..e8daf4da 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -725,7 +725,7 @@ def process(input_directory, input_name=None, status=0, client_agent='manual', d extract = int(cfg.get('extract', 0)) try: - if int(cfg.get('remote_path')) and not core.REMOTEPATHS: + if int(cfg.get('remote_path')) and not core.REMOTE_PATHS: logger.error('Remote Path is enabled for {0}:{1} but no Network mount points are defined. Please check your autoProcessMedia.cfg, exiting!'.format( section_name, input_category)) return ProcessResult(