mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Merge branch 'syno-debug' into dev
This commit is contained in:
commit
d01b721b0f
2 changed files with 20 additions and 20 deletions
|
@ -198,21 +198,17 @@ def initialize(section=None):
|
|||
if not config.migrate():
|
||||
logger.error("Unable to migrate config file %s, exiting ..." % (CONFIG_FILE))
|
||||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
sys.exit(NZBGET_POSTPROCESS_ERROR)
|
||||
pass # We will try and read config from Environment.
|
||||
else:
|
||||
sys.exit(-1)
|
||||
|
||||
# run migrate to convert NzbGet data from old cfg style to new cfg style
|
||||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
if not config.addnzbget():
|
||||
logger.error("Unable to migrate NzbGet config file %s, exiting ..." % (CONFIG_FILE))
|
||||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
sys.exit(NZBGET_POSTPROCESS_ERROR)
|
||||
else:
|
||||
sys.exit(-1)
|
||||
# load newly migrated config
|
||||
logger.info("Loading config from [%s]" % (CONFIG_FILE))
|
||||
CFG = config()
|
||||
CFG = config.addnzbget()
|
||||
|
||||
else: # load newly migrated config
|
||||
logger.info("Loading config from [%s]" % (CONFIG_FILE))
|
||||
CFG = config()
|
||||
|
||||
# Enable/Disable DEBUG Logging
|
||||
LOG_DEBUG = int(CFG['General']['log_debug'])
|
||||
|
|
|
@ -3,6 +3,7 @@ import shutil
|
|||
import copy
|
||||
import nzbtomedia
|
||||
from configobj import *
|
||||
from nzbtomedia import logger
|
||||
|
||||
from itertools import chain
|
||||
|
||||
|
@ -105,16 +106,16 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if not os.path.isfile(nzbtomedia.CONFIG_FILE):
|
||||
shutil.copyfile(nzbtomedia.CONFIG_SPEC_FILE, nzbtomedia.CONFIG_FILE)
|
||||
CFG_OLD = config(nzbtomedia.CONFIG_FILE)
|
||||
except:
|
||||
pass
|
||||
except Exception, e:
|
||||
logger.debug("Error %s when copying to .cfg" % (e))
|
||||
|
||||
try:
|
||||
# check for autoProcessMedia.cfg.spec and create if it does not exist
|
||||
if not os.path.isfile(nzbtomedia.CONFIG_SPEC_FILE):
|
||||
shutil.copyfile(nzbtomedia.CONFIG_FILE, nzbtomedia.CONFIG_SPEC_FILE)
|
||||
CFG_NEW = config(nzbtomedia.CONFIG_SPEC_FILE)
|
||||
except:
|
||||
pass
|
||||
except Exception, e:
|
||||
logger.debug("Error %s when copying to .spec" % (e))
|
||||
|
||||
# check for autoProcessMedia.cfg and autoProcessMedia.cfg.spec and if they don't exist return and fail
|
||||
if CFG_NEW is None or CFG_OLD is None:
|
||||
|
@ -358,14 +359,17 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
value = os.environ[key]
|
||||
CFG_NEW[section][option] = value
|
||||
|
||||
except:
|
||||
return False
|
||||
except Exception, e:
|
||||
logger.debug("Error %s when applying NZBGet config" % (e))
|
||||
|
||||
# write our new config to autoProcessMedia.cfg
|
||||
CFG_NEW.filename = nzbtomedia.CONFIG_FILE
|
||||
CFG_NEW.write()
|
||||
try:
|
||||
# write our new config to autoProcessMedia.cfg
|
||||
CFG_NEW.filename = nzbtomedia.CONFIG_FILE
|
||||
CFG_NEW.write()
|
||||
except Exception, e:
|
||||
logger.debug("Error %s when writing changes to .cfg" % (e))
|
||||
|
||||
return True
|
||||
return CFG_NEW
|
||||
|
||||
configobj.Section = Section
|
||||
configobj.ConfigObj = ConfigObj
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue