Added some error handling for invalid commandline options

This commit is contained in:
seiichiro 2012-08-29 10:47:20 +02:00
parent b60e8edf7a
commit 7fc87e6be9

View file

@ -48,8 +48,11 @@ def main(argv):
# CLI Argument Processing # CLI Argument Processing
try: try:
opts, args = getopt.getopt(argv, "i:o:m:v:a:t:hf", ["input=", "output=", "mpopts=", "abitrate=", "vbitrate=", "threads=", "help", "force-overwrite"]) opts, args = getopt.getopt(argv, "i:o:m:v:a:t:hf", ["input=", "output=", "mpopts=", "abitrate=", "vbitrate=", "threads=", "help", "force-overwrite"])
except getopt.GetoptError as err: except:
printi(str(err)) usage()
if (len(args) != 0):
print("Error: Unsupported Arguments found!")
usage() usage()
input = None input = None
@ -256,8 +259,10 @@ def cleanup():
# Cleanup # Cleanup
try: try:
if (mda != None): if (mda != None):
if (mda.pid() != None):
os.kill(mda.pid()) os.kill(mda.pid())
if (mdv != None): if (mdv != None):
if (mda.pid() != None):
os.kill(mdv.pid()) os.kill(mdv.pid())
finally: finally:
if (afifo != None): if (afifo != None):