Added ability to pass folder to be post-processed to Headphones, this only works on echel0n's fork of headphones!

This commit is contained in:
echel0n 2014-04-02 20:05:22 -07:00
commit e470983382
2 changed files with 17 additions and 13 deletions

View file

@ -57,12 +57,16 @@ def process(dirName, nzbName=None, status=0, inputCategory=None):
TimeOut += 60 # Add an extra minute for over-head/processing/metadata. TimeOut += 60 # Add an extra minute for over-head/processing/metadata.
socket.setdefaulttimeout(int(TimeOut)) #initialize socket timeout. socket.setdefaulttimeout(int(TimeOut)) #initialize socket timeout.
baseURL = protocol + host + ":" + port + web_root + "/api?apikey=" + apikey + "&cmd=" params = {}
params['apikey'] = apikey
params['cmd'] = "forceProcess"
params['dir'] = dirName
baseURL = protocol + host + ":" + port + web_root + "/api?" + + urllib.urlencode(params)
if status == 0: if status == 0:
command = "forceProcess"
url = baseURL + command url = baseURL
Logger.info("Waiting for %s seconds to allow HeadPhones to process newly extracted files", str(delay)) Logger.info("Waiting for %s seconds to allow HeadPhones to process newly extracted files", str(delay))
@ -79,11 +83,10 @@ def process(dirName, nzbName=None, status=0, inputCategory=None):
result = urlObj.readlines() result = urlObj.readlines()
Logger.info("HeadPhones returned %s", result) Logger.info("HeadPhones returned %s", result)
if result[0] == "OK": if result[0] == "OK":
Logger.info("%s started on HeadPhones for %s", command, nzbName) Logger.info("Post-processing started on HeadPhones for %s", nzbName)
else: else:
Logger.error("%s has NOT started on HeadPhones for %s. Exiting", command, nzbName) Logger.error("Post-processing has NOT started on HeadPhones for %s. Exiting", nzbName)
return 1 # failure return 1 # failure
else: else:
Logger.info("The download failed. Nothing to process") Logger.info("The download failed. Nothing to process")
return 0 # Success (as far as this script is concerned) return 0 # Success (as far as this script is concerned)

View file

@ -74,6 +74,14 @@ import autoProcess.autoProcessMusic as autoProcessMusic
from autoProcess.nzbToMediaEnv import * from autoProcess.nzbToMediaEnv import *
from autoProcess.nzbToMediaUtil import * from autoProcess.nzbToMediaUtil import *
# 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 to migrate old cfg before trying to load. #check to migrate old cfg before trying to load.
if os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg.sample")): if os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg.sample")):
migratecfg.migrate() migratecfg.migrate()
@ -94,13 +102,6 @@ WakeUp()
if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5] < '11.0': if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5] < '11.0':
Logger.info("MAIN: Script triggered from NZBGet (11.0 or later).") Logger.info("MAIN: 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 # Check nzbget.conf options
status = 0 status = 0