From 975e1c75679030d999edf02e98b265aa9243164a Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 3 Apr 2014 20:11:26 -0700 Subject: [PATCH] Fixed config checking code in migratecfg --- nzbtomedia/migratecfg.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/nzbtomedia/migratecfg.py b/nzbtomedia/migratecfg.py index 2f1daf06..bb074d2e 100644 --- a/nzbtomedia/migratecfg.py +++ b/nzbtomedia/migratecfg.py @@ -6,21 +6,25 @@ class migratecfg: def migrate(self): categories = [] + try: + # check for autoProcessMedia.cfg and create if it does not exist + if not config(config.CONFIG_FILE): + shutil.copyfile(config.SAMPLE_CONFIG_FILE, config.CONFIG_FILE) + configold = config(config.CONFIG_FILE) + except:pass + + try: + # check for autoProcessMedia.cfg.sample and create if it does not exist + if not config(config.SAMPLE_CONFIG_FILE): + 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): return False - # check for autoProcessMedia.cfg and create if it does not exist - if not config(config.CONFIG_FILE): - shutil.copyfile(config.SAMPLE_CONFIG_FILE, config.CONFIG_FILE) - configold = config(config.CONFIG_FILE) - - # check for autoProcessMedia.cfg.sample and create if it does not exist - if not config(config.SAMPLE_CONFIG_FILE): - shutil.copyfile(config.CONFIG_FILE, config.SAMPLE_CONFIG_FILE) - confignew = config(config.SAMPLE_CONFIG_FILE) - - 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"