improve fork handling. #199

This commit is contained in:
clinton-hall 2013-11-08 11:55:12 +10:30
commit 12cce95d89
3 changed files with 31 additions and 44 deletions

View file

@ -36,8 +36,8 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
extractionSuccess = False
Logger.debug("MAIN: Received Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory)
if sbFork in ["TPB", "TPB-failed"] and inputCategory == sbCategory:
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
if inputCategory == sbCategory and sbFork in SICKBEARD_TORRENT:
Logger.info("MAIN: Calling SickBeard's %s branch to post-process: %s",sbFork ,inputName)
result = autoProcessTV.processEpisode(inputDirectory, inputName, int(0))
if result == 1:
Logger.info("MAIN: A problem was reported in the autoProcess* script. If torrent was pasued we will resume seeding")

View file

@ -96,10 +96,10 @@ def processEpisode(dirName, nzbName=None, failed=False):
mediaContainer = (config.get("Extensions", "mediaExtensions")).split(',')
minSampleSize = int(config.get("Extensions", "minSampleSize"))
if not fork in ["TPB", "TPB-failed"]:
if not fork in SICKBEARD_TORRENT:
process_all_exceptions(nzbName.lower(), dirName)
if nzbName != "Manual Run" and not fork in ["TPB", "TPB-failed"]:
if nzbName != "Manual Run" and not fork in SICKBEARD_TORRENT:
# Now check if movie files exist in destination:
video = int(0)
for dirpath, dirnames, filenames in os.walk(dirName):
@ -125,47 +125,25 @@ def processEpisode(dirName, nzbName=None, failed=False):
params = {}
params['quiet'] = 1
# if you have specified you are using development branch from fork https://github.com/Tolstyak/Sick-Beard.git
if fork == "failed":
if fork in SICKBEARD_DIRNAME:
params['dirName'] = dirName
if nzbName != None:
params['nzbName'] = nzbName
params['failed'] = failed
if status == 0:
Logger.info("The download succeeded. Sending process request to SickBeard's failed branch")
else:
Logger.info("The download failed. Sending 'failed' process request to SickBeard's failed branch")
# if you have specified you are using development branch from fork https://github.com/Tolstyak/Sick-Beard.git
if fork in ["TPB", "TPB-failed"]:
params['dir'] = dirName
if nzbName != None:
params['nzbName'] = nzbName
if status == 0:
Logger.info("The download succeeded. Sending process request to SickBeard's TPB branch")
if fork == "TPB-failed":
params['failed'] = failed
elif fork == "TPB-failed":
Logger.info("The download failed. Sending 'failed' process request to SickBeard's TPB-failed branch")
params['failed'] = failed
else:
Logger.info("The download failed. Nothing to process")
if delete_failed and os.path.isdir(dirName) and not dirName in ['sys.argv[0]','/','']:
delete(dirName)
return 0 # Success (as far as this script is concerned)
# this is our default behaviour to work with the standard Master branch of SickBeard
elif fork == "default":
params['dir'] = dirName
if nzbName != None:
params['nzbName'] = nzbName
# the standard Master bamch of SickBeard cannot process failed downloads. So Exit here.
if fork in SICKBEARD_FAILED:
params['failed'] = failed
if status == 0:
Logger.info("The download succeeded. Sending process request to SickBeard")
Logger.info("The download succeeded. Sending process request to SickBeard's %s branch", fork)
elif fork in SICKBEARD_FAILED:
Logger.info("The download failed. Sending 'failed' process request to SickBeard's %s branch", fork)
else:
Logger.info("The download failed. Nothing to process")
Logger.info("The download failed. SickBeard's %s branch does not handle failed downloads. Nothing to process", fork)
if delete_failed and os.path.isdir(dirName) and not dirName in ['sys.argv[0]','/','']:
Logger.info("Deleting directory: %s", dirName)
delete(dirName)
return 0 # Success (as far as this script is concerned)

View file

@ -6,3 +6,12 @@ VERSION = 'V8.6'
# Constants pertinant to SabNzb
SABNZB_NO_OF_ARGUMENTS = 8
# Constants pertaining to SickBeard Branches:
# extend this list to include all branches/forks that use "failed" to handle failed downloads.
SICKBEARD_FAILED = ["failed", "TPB-failed", "Pistachitos"]
# extend this list to include all branches/forks that use "dirName" not "dir"
SICKBEARD_DIRNAME = ["failed"]
# extend this list to include all branches/forks that process rar and link files for torrents and therefore skip extraction and linking in TorrentToMedia.
SICKBEARD_TORRENT = ["TPB", "TPB-failed", "Pistachitos"]