Major overhaul of nzbToMedia code base plus a whole restrucure

This commit is contained in:
echel0n 2014-04-03 03:04:04 -07:00
parent e7751b96c5
commit 85d8739512
67 changed files with 1687 additions and 1734 deletions

24
ResetDateTime.py Executable file → Normal file
View file

@ -13,33 +13,27 @@
### NZBGET POST-PROCESSING SCRIPT ###
##############################################################################
import os
import sys
# NZBGet V11+
# Check if the script is called from nzbget 11.0 or later
import os
import sys
from nzbtomedia.nzbToMediaConfig import config
if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5] < '11.0':
print "Script triggered from NZBGet (11.0 or later)."
# NZBGet argv: all passed as environment variables.
# Exit codes used by NZBGet
POSTPROCESS_PARCHECK=92
POSTPROCESS_SUCCESS=93
POSTPROCESS_ERROR=94
POSTPROCESS_NONE=95
# Check nzbget.conf options
status = 0
if os.environ['NZBOP_UNPACK'] != 'yes':
print "Please enable option \"Unpack\" in nzbget configuration file, exiting."
sys.exit(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(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\"."
@ -70,7 +64,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(POSTPROCESS_NONE)
sys.exit(config.NZBGET_POSTPROCESS_NONE)
directory = os.path.normpath(os.environ['NZBPP_DIRECTORY'])
for dirpath, dirnames, filenames in os.walk(directory):
@ -82,8 +76,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(POSTPROCESS_ERROR)
sys.exit(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)."