From 77a279c77a9e4b5f27a188b0a099e436f64292fa Mon Sep 17 00:00:00 2001 From: Gabe Date: Mon, 27 Mar 2023 22:28:18 +0200 Subject: [PATCH] SABnzbd - Update replace_for.py to work with V.4.0.0 Sabnzbd Version 4.0.0 (current beta) introduced a couple of input variables, that weren't available in the versions before. This PR fixes the two scripts in the Guide, so they are compatible with earlier and V4+ versions https://sabnzbd.org/wiki/scripts/pre-queue-scripts#toc3 --- .../Downloaders/SABnzbd/scripts/replace_for/replace_for.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/Downloaders/SABnzbd/scripts/replace_for/replace_for.py b/docs/Downloaders/SABnzbd/scripts/replace_for/replace_for.py index d347394cf..0345f3650 100644 --- a/docs/Downloaders/SABnzbd/scripts/replace_for/replace_for.py +++ b/docs/Downloaders/SABnzbd/scripts/replace_for/replace_for.py @@ -20,7 +20,12 @@ import os import os.path try: - (scriptname, directory, orgnzbname, jobname, reportnumber, category, group, postprocstatus, url) = sys.argv + try: + # Parse the 18 input variables for SABnzbd version >= 4.0.0 + (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename, is_proper, resolution, decade, year, month, day, job_type) = sys.argv +except ValueError: + # ...or 11 variables for earlier versions + (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv except: print("No commandline parameters found") sys.exit(1) # exit with 1 causes SABnzbd to ignore the output of this script