From e51ff81dbe3bc6898fbf6b50a0d2c2e2249a661e Mon Sep 17 00:00:00 2001 From: echel0n Date: Tue, 1 Apr 2014 18:52:56 -0700 Subject: [PATCH] Added a chcek for sample cfg file and if not found it copies the .cfg to .sample and runs migratecfg so it can check the cfg over and make sure its not missing any sections, options, or values and migrates old cfg style to new cfg style. --- nzbToMedia.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nzbToMedia.py b/nzbToMedia.py index 901ebadc..881cd8e2 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -261,6 +261,7 @@ ### NZBGET POST-PROCESSING SCRIPT ### ############################################################################## +import shutil import logging import autoProcess.autoProcessComics as autoProcessComics @@ -278,9 +279,13 @@ POSTPROCESS_SUCCESS = 93 POSTPROCESS_ERROR = 94 POSTPROCESS_NONE = 95 -# check to migrate old cfg before trying to load. +# run migrate to convert old cfg to new style cfg plus fix any cfg missing values/options. if config(SAMPLE_CONFIG_FILE): migratecfg.migrate() +elif config(): + shutil.copyfile(CONFIG_FILE, SAMPLE_CONFIG_FILE) + migratecfg.migrate() + # check to write settings from nzbGet UI to autoProcessMedia.cfg. if os.environ.has_key('NZBOP_SCRIPTDIR'): migratecfg.addnzbget()