From f919a890ee882dd79bb398d6b80cfbc2fbe960fa Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Wed, 12 Feb 2014 13:27:58 +1030 Subject: [PATCH] fixed failed handling for SickBeard "torrent" branches. Fixes #229 #261 --- TorrentToMedia.py | 2 +- autoProcess/autoProcessTV.py | 5 ++++- changelog.txt | 1 + nzbToMedia.py | 2 +- nzbToSickBeard.py | 9 ++++++--- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index b2d43a6c..9f36fde0 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -245,7 +245,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): result = autoProcessMovie.process(outputDestination, inputName, status, clientAgent, download_id, inputCategory) elif inputCategory in sbCategory: Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName) - result = autoProcessTV.processEpisode(outputDestination, inputName, status, inputCategory) + result = autoProcessTV.processEpisode(outputDestination, inputName, status, clientAgent, inputCategory) elif inputCategory in hpCategory: Logger.info("MAIN: Calling HeadPhones to post-process: %s", inputName) result = autoProcessMusic.process(inputDirectory, inputName, status, inputCategory) diff --git a/autoProcess/autoProcessTV.py b/autoProcess/autoProcessTV.py index 9d5b7b93..4cdd73f9 100644 --- a/autoProcess/autoProcessTV.py +++ b/autoProcess/autoProcessTV.py @@ -41,7 +41,7 @@ def delete(dirName): Logger.exception("Unable to delete folder %s", dirName) -def processEpisode(dirName, nzbName=None, failed=False, inputCategory=None): +def processEpisode(dirName, nzbName=None, failed=False, clientAgent=None, inputCategory=None): status = int(failed) config = ConfigParser.ConfigParser() @@ -118,6 +118,9 @@ def processEpisode(dirName, nzbName=None, failed=False, inputCategory=None): if os.path.isdir(SpecificPath): dirName = SpecificPath + if clientAgent in ['nzbget','sabnzbd']: #Assume Torrent actions (unrar and link) don't happen. We need to check for valid media here. + SICKBEARD_TORRENT = [] + if not fork in SICKBEARD_TORRENT: process_all_exceptions(nzbName.lower(), dirName) nzbName, dirName = converto_to_ascii(nzbName, dirName) diff --git a/changelog.txt b/changelog.txt index e598b8ec..aaad291e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -11,6 +11,7 @@ Added list of common sample ids and a way to set deletion of All media files les Impacts NZBs Fix Error with manual run of nzbToMedia Make sure SickBeard receives the individula download dir. +Disabled SickBeard Torrent handling for NZBs. Fixes failed handling of nzbs that fail to extract. V9.1 24/01/2014 diff --git a/nzbToMedia.py b/nzbToMedia.py index c858520d..e8b4ecd5 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -406,7 +406,7 @@ if inputCategory in cpsCategory: result = autoProcessMovie.process(nzbDir, inputName, status, clientAgent, download_id, inputCategory) elif inputCategory in sbCategory: Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName) - result = autoProcessTV.processEpisode(nzbDir, inputName, status, inputCategory) + result = autoProcessTV.processEpisode(nzbDir, inputName, status, clientAgent, inputCategory) elif inputCategory in hpCategory: Logger.info("MAIN: Calling HeadPhones to post-process: %s", inputName) result = autoProcessMusic.process(nzbDir, inputName, status, inputCategory) diff --git a/nzbToSickBeard.py b/nzbToSickBeard.py index 49c84692..ff5f2279 100755 --- a/nzbToSickBeard.py +++ b/nzbToSickBeard.py @@ -207,7 +207,8 @@ 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) + clientAgent = "nzbget" + result = autoProcessTV.processEpisode(os.environ['NZBPP_DIRECTORY'], os.environ['NZBPP_NZBFILENAME'], status, clientAgent, os.environ['NZBPP_CATEGORY']) # SABnzbd Pre 0.7.17 elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # SABnzbd argv: @@ -219,7 +220,8 @@ elif len(sys.argv) == SABNZB_NO_OF_ARGUMENTS: # 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 Logger.info("Script triggered from SABnzbd, starting autoProcessTV...") - result = autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7]) + clientAgent = "sabnzbd" + result = autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5]) # SABnzbd 0.7.17+ elif len(sys.argv) >= SABNZB_0717_NO_OF_ARGUMENTS: # SABnzbd argv: @@ -232,7 +234,8 @@ elif len(sys.argv) >= SABNZB_0717_NO_OF_ARGUMENTS: # 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]) + clientAgent = "sabnzbd" + result = autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5]) else: Logger.debug("Invalid number of arguments received from client.") Logger.info("Running autoProcessTV as a manual run...")