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.

This commit is contained in:
echel0n 2014-04-01 18:52:56 -07:00
commit e51ff81dbe

View file

@ -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()