Support independent fallback commands

Allow specifying separate fallback commands. Not required, and will use
the main commands if not specified.

Closes #2
This commit is contained in:
Joshua M. Boniface 2020-08-11 23:23:27 -04:00
parent a0cda2755e
commit dcd08f6713
2 changed files with 10 additions and 2 deletions

View file

@ -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...

View file

@ -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"