Skip to content

Commit

Permalink
Added an extra check for invalid codec/extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwright committed Oct 14, 2023
1 parent e6efa1d commit 649587e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cq-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,20 @@ def main():
if args.outfile != None and args.codec == None:
# Determine the codec from the file extension
codec_temp = args.outfile.split('.')[-1]
if args.outfile != None and codec_temp != None:
if codec_temp != None:
codec_temp = "cq_codec_" + codec_temp
if codec_temp in loaded_codecs:
codec = codec_temp

# If the user has not supplied a codec, they need to be validating the script
if (codec == 'help' or (codec == None and args.outfile == None)) and (args.validate == None or args.validate == 'false'):
if (codec == None and args.outfile == None) and (args.validate == None or args.validate == 'false'):
print("Please specify a valid codec. You have the following to choose from:")
for key in loaded_codecs:
print(key.replace('cq_codec_', ''))
sys.exit(3)

# If the codec is None at this point, the user specified an invalid codec
if codec == None:
print("Please specify a valid codec. You have the following to choose from:")
for key in loaded_codecs:
print(key.replace('cq_codec_', ''))
Expand Down

0 comments on commit 649587e

Please sign in to comment.