From dcd08f6713b045d9e478a1f7f98332fce268bee6 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 11 Aug 2020 23:23:27 -0400 Subject: [PATCH] Support independent fallback commands Allow specifying separate fallback commands. Not required, and will use the main commands if not specified. Closes #2 --- rffmpeg.py | 8 ++++++-- rffmpeg.yml.sample | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rffmpeg.py b/rffmpeg.py index e2bd7b7..9fffad6 100755 --- a/rffmpeg.py +++ b/rffmpeg.py @@ -85,6 +85,10 @@ except Exception as e: logger('ERROR: Failed to load configuration: {}'.format(e)) exit(1) +# Handle the fallback configuration using get() to avoid failing +config['fallback_ffmpeg_command'] = o_config['rffmpeg']['commands'].get('fallback_ffmpeg', config['ffmpeg_command']) +config['fallback_ffprobe_command'] = o_config['rffmpeg']['commands'].get('fallback_ffprobe', config['ffprobe_command']) + # Parse CLI args (ffmpeg command line) all_args = sys.argv cli_ffmpeg_args = all_args[1:] @@ -108,10 +112,10 @@ def local_ffmpeg_fallback(): # Verify if we're in ffmpeg or ffprobe mode if 'ffprobe' in all_args[0]: - rffmpeg_command.append(config['ffprobe_command']) + rffmpeg_command.append(config['fallback_ffprobe_command']) stdout = sys.stdout else: - rffmpeg_command.append(config['ffmpeg_command']) + rffmpeg_command.append(config['fallback_ffmpeg_command']) # Determine if version, encorders, or decoders is an argument; if so, we output stdout to stdout # Weird workaround for something Jellyfin requires... diff --git a/rffmpeg.yml.sample b/rffmpeg.yml.sample index 9796f0c..f114a5c 100644 --- a/rffmpeg.yml.sample +++ b/rffmpeg.yml.sample @@ -50,3 +50,7 @@ rffmpeg: # The (remote) ffmpeg and ffprobe command binary paths ffmpeg: "/usr/lib/jellyfin-ffmpeg/ffmpeg" ffprobe: "/usr/lib/jellyfin-ffmpeg/ffprobe" + + # An optional local fallback ffmpeg and ffprobe, if you wish this to be different from the above paths + #fallback_ffmpeg: "/usr/lib/jellyfn-ffmpeg/ffmpeg" + #fallback_ffprobe: "/usr/lib/jellyfin-ffmpeg/ffprobe"