From 27cfc3457719163015fcb30db3464d6da721c425 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Mon, 25 Feb 2019 19:53:54 +1300 Subject: [PATCH] add sys path config to find executables not in path. Fixes #830 --- autoProcessMedia.cfg.spec | 2 ++ core/__init__.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/autoProcessMedia.cfg.spec b/autoProcessMedia.cfg.spec index ef3c362b..767d937c 100644 --- a/autoProcessMedia.cfg.spec +++ b/autoProcessMedia.cfg.spec @@ -22,6 +22,8 @@ log_env = 0 # Enable/Disable logging git output to debug nzbtomedia.log (helpful to track down update failures.) log_git = 0 + # Set to the directory to search for executables if not in default system path + sys_path = # Set to the directory where your ffmpeg/ffprobe executables are located ffmpeg_path = # Enable/Disable media file checking using ffprobe. diff --git a/core/__init__.py b/core/__init__.py index 4d935def..8d638dc4 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -191,6 +191,7 @@ GETSUBS = False TRANSCODE = None CONCAT = None FFMPEG_PATH = None +SYS_PATH = None DUPLICATE = None IGNOREEXTENSIONS = [] VEXTENSION = None @@ -352,6 +353,7 @@ def configure_general(): global GIT_BRANCH global FORCE_CLEAN global FFMPEG_PATH + global SYS_PATH global CHECK_MEDIA global SAFE_MODE global NOEXTRACTFAILED @@ -364,6 +366,7 @@ def configure_general(): GIT_BRANCH = CFG['General']['git_branch'] or 'master' FORCE_CLEAN = int(CFG['General']['force_clean']) FFMPEG_PATH = CFG['General']['ffmpeg_path'] + SYS_PATH = CFG['General']['sys_path'] CHECK_MEDIA = int(CFG['General']['check_media']) SAFE_MODE = int(CFG['General']['safe_mode']) NOEXTRACTFAILED = int(CFG['General']['no_extract_failed']) @@ -1016,6 +1019,8 @@ def configure_utility_locations(): logger.warning('Install ffmpeg with x264 support to enable this feature ...') else: + if SYS_PATH: + sys.path.append(SYS_PATH) try: SEVENZIP = subprocess.Popen(['which', '7z'], stdout=subprocess.PIPE).communicate()[0].strip().decode() except Exception: