diff --git a/autoProcessTV.py b/autoProcessTV.py index e7dc8392..b49923b8 100644 --- a/autoProcessTV.py +++ b/autoProcessTV.py @@ -42,8 +42,6 @@ class AuthURLOpener(urllib.FancyURLopener): def processEpisode(dirName, nzbName=None, failed=False): - - status = int(failed) config = ConfigParser.ConfigParser() configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessTV.cfg") print "Loading config from", configFilename @@ -60,7 +58,6 @@ def processEpisode(dirName, nzbName=None, failed=False): print "Could not read configuration file: ", str(e) sys.exit(1) - watch_dir = "" host = config.get("SickBeard", "host") port = config.get("SickBeard", "port") username = config.get("SickBeard", "username") @@ -75,47 +72,16 @@ def processEpisode(dirName, nzbName=None, failed=False): except ConfigParser.NoOptionError: web_root = "" - try: - watch_dir = config.get("SickBeard", "watch_dir") - except ConfigParser.NoOptionError: - watch_dir = "" - - try: - failed_fork = int(config.get("SickBeard", "failed_fork")) - except (ConfigParser.NoOptionError, ValueError): - failed_fork = 0 - - #allows us to specify the default watch directory and call the postproecssing on another PC with different directory structure. - if watch_dir != "": - dirName = watch_dir - params = {} params['quiet'] = 1 - # if you have specified you are using development branch from fork https://github.com/Tolstyak/Sick-Beard.git - if failed_fork: - params['dirName'] = dirName - if nzbName != None: - params['nzbName'] = nzbName - params['failed'] = failed - if status: - print "The download failed. Sending 'failed' process request to SickBeard's failed branch" - else: - print "The download succeeded. Sending process request to SickBeard's failed branch" - - # this is our default behaviour to work with the standard Master branch of SickBeard - else: - params['dir'] = dirName - if nzbName != None: - params['nzbName'] = nzbName - # the standard Master bamch of SickBeard cannot process failed downloads. So Exit here. - if status: - print "The download failed. Nothing to process" - sys.exit() - else: - print "The download succeeded. Sending process request to SickBeard" + params['dirName'] = dirName + if nzbName != None: + params['nzbName'] = nzbName + params['failed'] = failed + myOpener = AuthURLOpener(username, password) if ssl: diff --git a/nzbToSickBeard.py b/nzbToSickBeard.py index dd2a62fc..2be3da74 100644 --- a/nzbToSickBeard.py +++ b/nzbToSickBeard.py @@ -17,39 +17,22 @@ # # You should have received a copy of the GNU General Public License # along with Sick Beard. If not, see . -# -# Edited by Clinton Hall to prevent processing of failed downloads. -# Also added suppot for NZBGet. With help from thorli import sys import autoProcessTV -print "nzbToSickBeard V4.0" - -# SABnzbd -if len(sys.argv) == 8: -# 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 - print "Script triggered from SABnzbd, starting autoProcessTV..." - autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7]) - -# NZBGet -elif len(sys.argv) == 4: -# NZBGet argv: -# 1 The final directory of the job (full path) -# 2 The original name of the NZB file -# 3 The status of the download: 0 == successful - print "Script triggered from NZBGet, starting autoProcessTV..." - - autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[3]) - +if len(sys.argv) < 8: + print "Not enough arguments received from SABnzbd. Please update it." + sys.exit() else: - print "Invalid number of arguments received from client." - sys.exit() + autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7]) + +# 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+21