mirror of
https://github.com/sabnzbd/sabnzbd.git
synced 2025-12-28 02:00:34 -05:00
Add some basic support for X-DNZB-Failure and X-DNZB-Details headers coming from indexers.
”Failure” will send an extra URL parameter to the post processing script. ”Details” will override ”More-info” in the History.
This commit is contained in:
@@ -414,7 +414,7 @@ def build_history_info(nzo, storage='', downpath='', postproc_time=0, script_out
|
||||
downloaded = nzo.bytes_downloaded
|
||||
completeness = 0
|
||||
fail_message = decode_factory(nzo.fail_msg)
|
||||
url_info = nzo_info.get('more_info', '')
|
||||
url_info = nzo_info.get('details', '') or nzo_info.get('more_info', '')
|
||||
|
||||
# Get the dictionary containing the stages and their unpack process
|
||||
stages = decode_factory(nzo.unpack_info)
|
||||
|
||||
@@ -136,11 +136,11 @@ def find_programs(curdir):
|
||||
sabnzbd.newsunpack.RAR_PROBLEM = not unrar_check(sabnzbd.newsunpack.RAR_COMMAND)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
def external_processing(extern_proc, complete_dir, filename, nicename, cat, group, status):
|
||||
def external_processing(extern_proc, complete_dir, filename, nicename, cat, group, status, failure_url):
|
||||
""" Run a user postproc script, return console output and exit value
|
||||
"""
|
||||
command = [str(extern_proc), str(complete_dir), str(filename),
|
||||
str(nicename), '', str(cat), str(group), str(status)]
|
||||
str(nicename), '', str(cat), str(group), str(status), str(failure_url)]
|
||||
|
||||
if extern_proc.endswith('.py') and (sabnzbd.WIN32 or not os.access(extern_proc, os.X_OK)):
|
||||
command.insert(0, 'python')
|
||||
@@ -148,7 +148,7 @@ def external_processing(extern_proc, complete_dir, filename, nicename, cat, grou
|
||||
env = fix_env()
|
||||
|
||||
logging.info('Running external script %s(%s, %s, %s, %s, %s, %s, %s)',
|
||||
extern_proc, complete_dir, filename, nicename, '', cat, group, status)
|
||||
extern_proc, complete_dir, filename, nicename, '', cat, group, status, failure_url)
|
||||
|
||||
try:
|
||||
p = subprocess.Popen(command, shell=need_shell, stdin=subprocess.PIPE,
|
||||
|
||||
@@ -435,9 +435,16 @@ def process_job(nzo):
|
||||
nzo.status = Status.RUNNING
|
||||
nzo.set_action_line(T('Running script'), unicoder(script))
|
||||
nzo.set_unpack_info('Script', T('Running user script %s') % unicoder(script), unique=True)
|
||||
<<<<<<< HEAD
|
||||
script_log, script_ret = external_processing(short_path(script_path, False), short_path(workdir_complete, False), nzo.filename,
|
||||
dirname, cat, nzo.group, job_result)
|
||||
script_line = get_last_line(script_log)
|
||||
=======
|
||||
script_log, script_ret = external_processing(script_path, workdir_complete, nzo.filename,
|
||||
msgid, dirname, cat, nzo.group, job_result,
|
||||
nzo.nzo_info.get('failure', ''))
|
||||
script_line = get_last_line(script_log)
|
||||
>>>>>>> f68de5d... Add some basic support for X-DNZB-Failure and X-DNZB-Details headers coming from indexers.
|
||||
if script_log:
|
||||
script_output = nzo.nzo_id
|
||||
if script_line:
|
||||
|
||||
@@ -135,6 +135,10 @@ class URLGrabber(Thread):
|
||||
nzo_info['episodename'] = value
|
||||
elif item == 'x-dnzb-year':
|
||||
nzo_info['year'] = value
|
||||
elif item == 'x-dnzb-failure':
|
||||
nzo_info['failure'] = value
|
||||
elif item == 'x-dnzb-details':
|
||||
nzo_info['details'] = value
|
||||
elif item in ('content-length',):
|
||||
length = misc.int_conv(value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user