From 6720aa463c393435835bf1b01b7222091bab4eed Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Fri, 20 Dec 2013 11:48:08 +1030 Subject: [PATCH] added new argument for SABnzbd0.7.17+. fixes #222 --- autoProcess/nzbToMediaEnv.py | 1 + changelog.txt | 3 +++ nzbToCouchPotato.py | 16 +++++++++++++++- nzbToGamez.py | 15 ++++++++++++++- nzbToHeadPhones.py | 15 ++++++++++++++- nzbToMedia.py | 16 +++++++++++++++- nzbToMylar.py | 15 ++++++++++++++- nzbToSickBeard.py | 15 ++++++++++++++- 8 files changed, 90 insertions(+), 6 deletions(-) diff --git a/autoProcess/nzbToMediaEnv.py b/autoProcess/nzbToMediaEnv.py index cb5434a2..aaea44df 100644 --- a/autoProcess/nzbToMediaEnv.py +++ b/autoProcess/nzbToMediaEnv.py @@ -5,6 +5,7 @@ VERSION = 'V8.6' # Constants pertinant to SabNzb SABNZB_NO_OF_ARGUMENTS = 8 +SABNZB_0717_NO_OF_ARGUMENTS = 9 # Constants pertaining to SickBeard Branches: # extend this list to include all branches/forks that use "failed" to handle failed downloads. diff --git a/changelog.txt b/changelog.txt index 0505efba..7bf438c5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,9 @@ Change_LOG / History V8.6 xx/xx/2013 +Impacts NZBs +SABnzbd 0.7.17+ now uses 8 arguments, not 7. These scripts now support the extra argument. + Impacts Torrents Moved delete to end of routine, only when succesful process occurs. Don't flatten hp category (in case multi cd album) diff --git a/nzbToCouchPotato.py b/nzbToCouchPotato.py index ea95f6a1..5d7c013e 100755 --- a/nzbToCouchPotato.py +++ b/nzbToCouchPotato.py @@ -205,7 +205,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 Logger.info("Script triggered from NZBGet, starting autoProcessMovie...") clientAgent = "nzbget" result = autoProcessMovie.process(os.environ['NZBPP_DIRECTORY'], os.environ['NZBPP_NZBNAME'], status, clientAgent, download_id) -# SABnzbd +# SABnzbd Pre 0.7.17 elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # SABnzbd argv: # 1 The final directory of the job (full path) @@ -218,6 +218,20 @@ elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: Logger.info("Script triggered from SABnzbd, starting autoProcessMovie...") clientAgent = "sabnzbd" result = autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent) +# SABnzbd 0.7.17+ +elif len(sys.argv) == SABNZB_0717_NO_OF_ARGUMENTS: + # SABnzbd argv: + # 1 The final directory of the job (full path) + # 2 The original name of the NZB file + # 3 Clean version of the job name (no path info and ".nzb" removed) + # 4 Indexer's report number (if supported) + # 5 User-defined category + # 6 Group that the NZB was posted in e.g. alt.binaries.x + # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 + # 8 Failure URL + Logger.info("Script triggered from SABnzbd 0.7.17+, starting autoProcessMovie...") + clientAgent = "sabnzbd" + result = autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent) else: Logger.warn("Invalid number of arguments received from client.") Logger.info("Running autoProcessMovie as a manual run...") diff --git a/nzbToGamez.py b/nzbToGamez.py index 873a90a9..2f1f290f 100755 --- a/nzbToGamez.py +++ b/nzbToGamez.py @@ -146,7 +146,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 # All checks done, now launching the script. Logger.info("Script triggered from NZBGet, starting autoProcessGames...") result = autoProcessGames.process(os.environ['NZBPP_DIRECTORY'], os.environ['NZBPP_NZBNAME'], status) -# SABnzbd +# SABnzbd Pre 0.7.17 elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # SABnzbd argv: # 1 The final directory of the job (full path) @@ -158,6 +158,19 @@ elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 Logger.info("Script triggered from SABnzbd, starting autoProcessGames...") result = autoProcessGames.process(sys.argv[1], sys.argv[3], sys.argv[7]) +# SABnzbd 0.7.17+ +elif len(sys.argv) == SABNZB_0717_NO_OF_ARGUMENTS: + # SABnzbd argv: + # 1 The final directory of the job (full path) + # 2 The original name of the NZB file + # 3 Clean version of the job name (no path info and ".nzb" removed) + # 4 Indexer's report number (if supported) + # 5 User-defined category + # 6 Group that the NZB was posted in e.g. alt.binaries.x + # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 + # 8 Failure URL + Logger.info("Script triggered from SABnzbd 0.7.17+, starting autoProcessGames...") + result = autoProcessGames.process(sys.argv[1], sys.argv[3], sys.argv[7]) else: Logger.warn("Invalid number of arguments received from client. Exiting") sys.exit(1) diff --git a/nzbToHeadPhones.py b/nzbToHeadPhones.py index dfc4cc66..f467bbe2 100755 --- a/nzbToHeadPhones.py +++ b/nzbToHeadPhones.py @@ -151,7 +151,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 # All checks done, now launching the script Logger.info("Script triggered from NZBGet, starting autoProcessMusic...") result = autoProcessMusic.process(os.environ['NZBPP_DIRECTORY'], os.environ['NZBPP_NZBNAME'], status) -# SABnzbd +# SABnzbd Pre 0.7.17 elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # SABnzbd argv: # 1 The final directory of the job (full path) @@ -163,6 +163,19 @@ elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 Logger.info("Script triggered from SABnzbd, starting autoProcessMusic...") result = autoProcessMusic.process(sys.argv[1], sys.argv[2], sys.argv[7]) +# SABnzbd 0.7.17+ +elif len(sys.argv) == SABNZB_0717_NO_OF_ARGUMENTS: + # SABnzbd argv: + # 1 The final directory of the job (full path) + # 2 The original name of the NZB file + # 3 Clean version of the job name (no path info and ".nzb" removed) + # 4 Indexer's report number (if supported) + # 5 User-defined category + # 6 Group that the NZB was posted in e.g. alt.binaries.x + # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 + # 8 Failue URL + Logger.info("Script triggered from SABnzbd 0.7.17+, starting autoProcessMusic...") + result = autoProcessMusic.process(sys.argv[1], sys.argv[2], sys.argv[7]) else: Logger.warn("Invalid number of arguments received from client.") Logger.info("Running autoProcessMusic as a manual run...") diff --git a/nzbToMedia.py b/nzbToMedia.py index 37df0cdf..ff3ac0e8 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -353,7 +353,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 if os.environ.has_key('NZBPR_COUCHPOTATO'): download_id = os.environ['NZBPR_COUCHPOTATO'] nzbDir, inputName, inputCategory = (os.environ['NZBPP_DIRECTORY'], os.environ['NZBPP_NZBFILENAME'], os.environ['NZBPP_CATEGORY']) -# SABnzbd +# SABnzbd Pre 0.7.17 elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # SABnzbd argv: # 1 The final directory of the job (full path) @@ -366,6 +366,20 @@ elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: Logger.info("MAIN: Script triggered from SABnzbd") clientAgent = "sabnzbd" nzbDir, inputName, status, inputCategory, download_id = (sys.argv[1], sys.argv[2], sys.argv[7], sys.argv[5], '') +# SABnzbd 0.7.17+ +elif len(sys.argv) == SABNZB_0717_NO_OF_ARGUMENTS: + # SABnzbd argv: + # 1 The final directory of the job (full path) + # 2 The original name of the NZB file + # 3 Clean version of the job name (no path info and ".nzb" removed) + # 4 Indexer's report number (if supported) + # 5 User-defined category + # 6 Group that the NZB was posted in e.g. alt.binaries.x + # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 + # 8 Failure URL + Logger.info("MAIN: Script triggered from SABnzbd 0.7.17+") + clientAgent = "sabnzbd" + nzbDir, inputName, status, inputCategory, download_id = (sys.argv[1], sys.argv[2], sys.argv[7], sys.argv[5], '') else: # only CPS supports this manual run for now. Logger.warn("MAIN: Invalid number of arguments received from client.") Logger.info("MAIN: Running autoProcessMovie as a manual run...") diff --git a/nzbToMylar.py b/nzbToMylar.py index e9dfad25..1a63406b 100755 --- a/nzbToMylar.py +++ b/nzbToMylar.py @@ -149,7 +149,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 # All checks done, now launching the script. Logger.info("Script triggered from NZBGet, starting autoProcessComics...") result = autoProcessComics.processEpisode(os.environ['NZBPP_DIRECTORY'], os.environ['NZBPP_NZBNAME'], status) -# SABnzbd +# SABnzbd Pre 0.7.17 elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # SABnzbd argv: # 1 The final directory of the job (full path) @@ -161,6 +161,19 @@ elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 Logger.info("Script triggered from SABnzbd, starting autoProcessComics...") result = autoProcessComics.processEpisode(sys.argv[1], sys.argv[3], sys.argv[7]) +# SABnzbd 0.7.17+ +elif len(sys.argv) == SABNZB_0717_NO_OF_ARGUMENTS: + # SABnzbd argv: + # 1 The final directory of the job (full path) + # 2 The original name of the NZB file + # 3 Clean version of the job name (no path info and ".nzb" removed) + # 4 Indexer's report number (if supported) + # 5 User-defined category + # 6 Group that the NZB was posted in e.g. alt.binaries.x + # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 + # 8 Failure URL + Logger.info("Script triggered from SABnzbd 0.7.17+, starting autoProcessComics...") + result = autoProcessComics.processEpisode(sys.argv[1], sys.argv[3], sys.argv[7]) else: Logger.warn("Invalid number of arguments received from client.") Logger.info("Running autoProcessComics as a manual run...") diff --git a/nzbToSickBeard.py b/nzbToSickBeard.py index 2f827194..150e3981 100755 --- a/nzbToSickBeard.py +++ b/nzbToSickBeard.py @@ -198,7 +198,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5 # All checks done, now launching the script. Logger.info("Script triggered from NZBGet, starting autoProcessTV...") result = autoProcessTV.processEpisode(os.environ['NZBPP_DIRECTORY'], os.environ['NZBPP_NZBFILENAME'], status) -# SABnzbd +# SABnzbd Pre 0.7.17 elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # SABnzbd argv: # 1 The final directory of the job (full path) @@ -210,6 +210,19 @@ elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 Logger.info("Script triggered from SABnzbd, starting autoProcessTV...") result = autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7]) +# SABnzbd 0.7.17+ +elif len(sys.argv) == SABNZB_0717_NO_OF_ARGUMENTS: + # SABnzbd argv: + # 1 The final directory of the job (full path) + # 2 The original name of the NZB file + # 3 Clean version of the job name (no path info and ".nzb" removed) + # 4 Indexer's report number (if supported) + # 5 User-defined category + # 6 Group that the NZB was posted in e.g. alt.binaries.x + # 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2 + # 8 Failure URL + Logger.info("Script triggered from SABnzbd 0.7.17+, starting autoProcessTV...") + result = autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7]) else: Logger.debug("Invalid number of arguments received from client.") Logger.info("Running autoProcessTV as a manual run...")