Fixed error parsing input options

This commit is contained in:
2013-07-13 21:06:47 +10:00
parent dc5691130f
commit 7e777a4719
2 changed files with 8 additions and 4 deletions

View File

@@ -56,6 +56,8 @@ def processarguments(options):
inputoptions = namedtuple("inputoptions", inputoptions = namedtuple("inputoptions",
"numfiles doencode readonly dolist") "numfiles doencode readonly dolist")
inputoptions.readonly = False
for opt, arg in options: for opt, arg in options:
if opt == '-h': if opt == '-h':
showhelp() showhelp()
@@ -68,7 +70,6 @@ def processarguments(options):
inputoptions.numfiles = arg inputoptions.numfiles = arg
elif opt == "-l": elif opt == "-l":
inputoptions.readonly = True inputoptions.readonly = True
inputoptions.dolist = True
return inputoptions return inputoptions
@@ -77,19 +78,19 @@ def main(argv):
""" """
The main program for TVEncoder. The main program for TVEncoder.
""" """
print argv
try: try:
opts, args = getopt.getopt(argv, "hlpen:") opts, args = getopt.getopt(argv, "hlpen:")
except getopt.GetoptError: except getopt.GetoptError:
showhelp() showhelp()
sys.exit(2) sys.exit(2)
print opts
inputoptions = processarguments(opts) inputoptions = processarguments(opts)
settings = Settings("settings.cfg") settings = Settings("settings.cfg")
filemanager = FileManager(settings) filemanager = FileManager(settings)
if inputoptions.readonly and inputoptions.dolist: if inputoptions.readonly:
if inputoptions.doencode: if inputoptions.doencode:
#Generate the list of files that would be encoded #Generate the list of files that would be encoded
showdata = filemanager.getencodingfiles(inputoptions.readonly) showdata = filemanager.getencodingfiles(inputoptions.readonly)

View File

@@ -6,10 +6,13 @@ Created on Fri Jul 5 14:12:26 2013
""" """
import unittest import unittest
import os
import sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir) sys.path.insert(0, parentdir)
from libfilemanager import EncodeData from libfilemanager import EncodeData
class libfilemanagertest(unittest.TestCase): class libfilemanagertest(unittest.TestCase):
def test_EncodeDataPrint(self): def test_EncodeDataPrint(self):
showname = "test show" showname = "test show"