diff --git a/.gitignore b/.gitignore index d47fee77..a810d779 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ autoProcessMedia.cfg +logging.cfg *.pyc *.pyo diff --git a/DeleteSamples.py b/DeleteSamples.py old mode 100644 new mode 100755 index b1a917a5..43592ad5 --- a/DeleteSamples.py +++ b/DeleteSamples.py @@ -62,13 +62,13 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 if os.environ['NZBOP_UNPACK'] != 'yes': print "Please enable option \"Unpack\" in nzbget configuration file, exiting." - sys.exit(config().POSTPROCESS_ERROR) + sys.exit(config.NZBGET_POSTPROCESS_ERROR) # Check par status if os.environ['NZBPP_PARSTATUS'] == '3': print "Par-check successful, but Par-repair disabled, exiting." print "Please check your Par-repair settings for future downloads." - sys.exit(config().POSTPROCESS_NONE) + sys.exit(config.NZBGET_POSTPROCESS_NONE) if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4': print "Par-repair failed, setting status \"failed\"." @@ -99,7 +99,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 # All checks done, now launching the script. if status == 1: - sys.exit(config().POSTPROCESS_NONE) + sys.exit(config.NZBGET_POSTPROCESS_NONE) mediaContainer = os.environ['NZBPO_MEDIAEXTENSIONS'].split(',') SampleIDs = os.environ['NZBPO_SAMPLEIDS'].split(',') @@ -116,8 +116,8 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 os.unlink(filePath) except: print "Error: unable to delete file", filePath - sys.exit(config().POSTPROCESS_ERROR) - sys.exit(config().POSTPROCESS_SUCCESS) + sys.exit(config.NZBGET_POSTPROCESS_ERROR) + sys.exit(config.NZBGET_POSTPROCESS_SUCCESS) else: print "This script can only be called from NZBGet (11.0 or later)." diff --git a/ResetDateTime.py b/ResetDateTime.py old mode 100644 new mode 100755 index 7d5b11ad..4965b8a9 --- a/ResetDateTime.py +++ b/ResetDateTime.py @@ -29,13 +29,13 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 if os.environ['NZBOP_UNPACK'] != 'yes': print "Please enable option \"Unpack\" in nzbget configuration file, exiting." - sys.exit(config().POSTPROCESS_ERROR) + sys.exit(config.NZBGET_POSTPROCESS_ERROR) # Check par status if os.environ['NZBPP_PARSTATUS'] == '3': print "Par-check successful, but Par-repair disabled, exiting." print "Please check your Par-repair settings for future downloads." - sys.exit(config().POSTPROCESS_NONE) + sys.exit(config.NZBGET_POSTPROCESS_NONE) if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4': print "Par-repair failed, setting status \"failed\"." @@ -66,7 +66,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 # All checks done, now launching the script. if status == 1: - sys.exit(config().POSTPROCESS_NONE) + sys.exit(config.NZBGET_POSTPROCESS_NONE) directory = os.path.normpath(os.environ['NZBPP_DIRECTORY']) for dirpath, dirnames, filenames in os.walk(directory): @@ -78,8 +78,8 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 continue except: print "Error: unable to reset time for file", file - sys.exit(config().POSTPROCESS_ERROR) - sys.exit(config().POSTPROCESS_SUCCESS) + sys.exit(config.NZBGET_POSTPROCESS_ERROR) + sys.exit(config.NZBGET_POSTPROCESS_SUCCESS) else: print "This script can only be called from NZBGet (11.0 or later)." diff --git a/nzbToMedia.py b/nzbToMedia.py index 214a52a3..bf2a9de9 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -79,7 +79,7 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib' # SickBeard script category. # # category that gets called for post-processing with SickBeard. -#config().sbCategory=tv +#sbCategory=tv # SickBeard host. #sbhost=localhost diff --git a/nzbtomedia/migratecfg.py b/nzbtomedia/migratecfg.py index d1382a65..4aafbe3e 100644 --- a/nzbtomedia/migratecfg.py +++ b/nzbtomedia/migratecfg.py @@ -133,62 +133,71 @@ class migratecfg: envCatKey = 'NZBPO_CPSCATEGORY' envKeys = ['APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'DELAY', 'METHOD', 'DELETE_FAILED', 'REMOTECPS', 'WAIT_FOR', 'TIMEPERGIB'] cfgKeys = ['apikey', 'host', 'port', 'ssl', 'web_root', 'delay', 'method', 'delete_failed', 'remoteCPS', 'wait_for', 'TimePerGiB'] - for index in range(len(envKeys)): - key = 'NZBPO_CPS' + envKeys[index] - if os.environ.has_key(key): - option = cfgKeys[index] - value = os.environ[key] - if os.environ[envCatKey] in confignew[section].sections: - confignew[section][envCatKey][option] = value - + if os.environ.has_key(envCatKey): + for index in range(len(envKeys)): + key = 'NZBPO_CPS' + envKeys[index] + if os.environ.has_key(key): + option = cfgKeys[index] + value = os.environ[key] + if os.environ[envCatKey] not in confignew[section].sections: + confignew[section][os.environ[envCatKey]] = {} + confignew[section][os.environ[envCatKey]][option] = value section = "SickBeard" envCatKey = 'NZBPO_SBCATEGORY' envKeys = ['HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'TIMEPERGIB', 'PROCESS_METHOD'] cfgKeys = ['host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'TimePerGiB', 'process_method'] - for index in range(len(envKeys)): - key = 'NZBPO_SB' + envKeys[index] - if os.environ.has_key(key): - option = cfgKeys[index] - value = os.environ[key] - if os.environ[envCatKey] in confignew[section].sections: - confignew[section][envCatKey][option] = value + if os.environ.has_key(envCatKey): + for index in range(len(envKeys)): + key = 'NZBPO_SB' + envKeys[index] + if os.environ.has_key(key): + option = cfgKeys[index] + value = os.environ[key] + if os.environ[envCatKey] not in confignew[section].sections: + confignew[section][os.environ[envCatKey]] = {} + confignew[section][os.environ[envCatKey]][option] = value section = "HeadPhones" envCatKey = 'NZBPO_HPCATEGORY' envKeys = ['APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'DELAY', 'TIMEPERGIB'] cfgKeys = ['apikey', 'host', 'port', 'ssl', 'web_root', 'delay', 'TimePerGiB'] - for index in range(len(envKeys)): - key = 'NZBPO_HP' + envKeys[index] - if os.environ.has_key(key): - option = cfgKeys[index] - value = os.environ[key] - if os.environ[envCatKey] in confignew[section].sections: - confignew[section][envCatKey][option] = value + if os.environ.has_key(envCatKey): + for index in range(len(envKeys)): + key = 'NZBPO_HP' + envKeys[index] + if os.environ.has_key(key): + option = cfgKeys[index] + value = os.environ[key] + if os.environ[envCatKey] not in confignew[section].sections: + confignew[section][os.environ[envCatKey]] = {} + confignew[section][os.environ[envCatKey]][option] = value section = "Mylar" envCatKey = 'NZBPO_MYCATEGORY' envKeys = ['HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT'] cfgKeys = ['host', 'port', 'username', 'password', 'ssl', 'web_root'] - for index in range(len(envKeys)): - key = 'NZBPO_MY' + envKeys[index] - if os.environ.has_key(key): - option = cfgKeys[index] - value = os.environ[key] - if os.environ[envCatKey] in confignew[section].sections: - confignew[section][envCatKey][option] = value + if os.environ.has_key(envCatKey): + for index in range(len(envKeys)): + key = 'NZBPO_MY' + envKeys[index] + if os.environ.has_key(key): + option = cfgKeys[index] + value = os.environ[key] + if os.environ[envCatKey] not in confignew[section].sections: + confignew[section][os.environ[envCatKey]] = {} + confignew[section][os.environ[envCatKey]][option] = value section = "Gamez" envCatKey = 'NZBPO_GZCATEGORY' envKeys = ['APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT'] cfgKeys = ['apikey', 'host', 'port', 'ssl', 'web_root'] - for index in range(len(envKeys)): - key = 'NZBPO_GZ' + envKeys[index] - if os.environ.has_key(key): - option = cfgKeys[index] - value = os.environ[key] - if os.environ[envCatKey] in confignew[section].sections: - confignew[section][envCatKey][option] = value + if os.environ.has_key(envCatKey): + for index in range(len(envKeys)): + key = 'NZBPO_GZ' + envKeys[index] + if os.environ.has_key(key): + option = cfgKeys[index] + value = os.environ[key] + if os.environ[envCatKey] not in confignew[section].sections: + confignew[section][os.environ[envCatKey]] = {} + confignew[section][os.environ[envCatKey]][option] = value section = "Extensions" envKeys = ['COMPRESSEDEXTENSIONS', 'MEDIAEXTENSIONS', 'METAEXTENSIONS']