From cf0b2aae7c18b8e88acf1c9432a3bd4a767c73f1 Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 3 Apr 2014 20:14:15 -0700 Subject: [PATCH] Added more error checking code to migratecfg --- nzbtomedia/migratecfg.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nzbtomedia/migratecfg.py b/nzbtomedia/migratecfg.py index bb074d2e..a407d6fb 100644 --- a/nzbtomedia/migratecfg.py +++ b/nzbtomedia/migratecfg.py @@ -5,6 +5,8 @@ from nzbtomedia.nzbToMediaConfig import config class migratecfg: def migrate(self): categories = [] + confignew = None + configold = None try: # check for autoProcessMedia.cfg and create if it does not exist @@ -19,12 +21,12 @@ class migratecfg: shutil.copyfile(config.CONFIG_FILE, config.SAMPLE_CONFIG_FILE) confignew = config(config.SAMPLE_CONFIG_FILE) except:pass - + # check for autoProcessMedia.cfg and autoProcessMedia.cfg.sample and if they don't exist return and fail - if not config() and not config(config.SAMPLE_CONFIG_FILE): + if not config() and not config(config.SAMPLE_CONFIG_FILE) or not confignew or not configold: return False - section = "CouchPotato" + section = "CouchPotato" for option, value in configold.items(section) or config(config.MOVIE_CONFIG_FILE).items(section): if option == "category": # change this old format option = "cpsCategory"