diff --git a/nzbToMediaConfig.py b/nzbToMediaConfig.py index a70b8700..486a1c81 100644 --- a/nzbToMediaConfig.py +++ b/nzbToMediaConfig.py @@ -13,7 +13,7 @@ MOVIE_CONFIG_FILE = os.path.join(PROG_DIR, "autoProcessMovie.cfg") TV_CONFIG_FILE = os.path.join(PROG_DIR, "autoProcessTv.cfg") LOG_FILE = os.path.join(PROG_DIR, "postprocess.log") -class config(ConfigParser.ConfigParser): +class configParser(object): # link error handlers Error = ConfigParser.Error @@ -27,15 +27,14 @@ class config(ConfigParser.ConfigParser): ParsingError = ConfigParser.ParsingError MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError - def __init__(self, *file): - try: - ConfigParser.ConfigParser.__init__(self) - self.optionxform = str - if not file: - file = CONFIG_FILE - if self.read(file): - pass - else: - raise self.Error('Cannot open configuration file') - except IOError, error: - exit(error) \ No newline at end of file + @staticmethod + def config(*file): + # if no file specified then load our default config + if not file:file = CONFIG_FILE + + # load config + parser = ConfigParser.ConfigParser() + parser.optionxform = str + if parser.read(file):return parser + +config = configParser.config \ No newline at end of file