Fixed config checking code in migratecfg

This commit is contained in:
echel0n 2014-04-03 20:11:26 -07:00
commit 975e1c7567

View file

@ -6,19 +6,23 @@ class migratecfg:
def migrate(self): def migrate(self):
categories = [] categories = []
# check for autoProcessMedia.cfg and autoProcessMedia.cfg.sample and if they don't exist return and fail try:
if not config() and not config(config.SAMPLE_CONFIG_FILE):
return False
# check for autoProcessMedia.cfg and create if it does not exist # check for autoProcessMedia.cfg and create if it does not exist
if not config(config.CONFIG_FILE): if not config(config.CONFIG_FILE):
shutil.copyfile(config.SAMPLE_CONFIG_FILE, config.CONFIG_FILE) shutil.copyfile(config.SAMPLE_CONFIG_FILE, config.CONFIG_FILE)
configold = config(config.CONFIG_FILE) configold = config(config.CONFIG_FILE)
except:pass
try:
# check for autoProcessMedia.cfg.sample and create if it does not exist # check for autoProcessMedia.cfg.sample and create if it does not exist
if not config(config.SAMPLE_CONFIG_FILE): if not config(config.SAMPLE_CONFIG_FILE):
shutil.copyfile(config.CONFIG_FILE, config.SAMPLE_CONFIG_FILE) shutil.copyfile(config.CONFIG_FILE, config.SAMPLE_CONFIG_FILE)
confignew = config(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
section = "CouchPotato" section = "CouchPotato"
for option, value in configold.items(section) or config(config.MOVIE_CONFIG_FILE).items(section): for option, value in configold.items(section) or config(config.MOVIE_CONFIG_FILE).items(section):