change handling of SB_Torrent.

This commit is contained in:
clinton-hall 2014-04-03 12:50:35 +10:30
commit e3bb60aa57
4 changed files with 13 additions and 20 deletions

View file

@ -40,7 +40,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
sbFork, sbParams = autoFork()
if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT and Torrent_ForceLink != 1:
if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT and Torrent_NoLink == 1:
Logger.info("MAIN: Calling SickBeard's %s branch to post-process: %s",sbFork ,inputName)
result = autoProcessTV.processEpisode(inputDirectory, inputName, int(0))
if result == 1:
@ -121,8 +121,6 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
Logger.debug("MAIN: Scanning files in directory: %s", inputDirectory)
noFlatten.extend(hpCategory) # Make sure we preserve folder structure for HeadPhones.
if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT: # Don't flatten when sending to SICKBEARD_TORRENT
noFlatten.extend(sbCategory)
outputDestinationMaster = outputDestination # Save the original, so we can change this within the loop below, and reset afterwards.
now = datetime.datetime.now()
@ -163,15 +161,6 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
else:
continue # This file has not been recently moved or created, skip it
if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT: # We want to link every file.
Logger.info("MAIN: Found file %s in %s", fileExtension, filePath)
try:
copy_link(filePath, targetDirectory, useLink, outputDestination)
copy_list.append([filePath, os.path.join(outputDestination, file)])
except:
Logger.exception("MAIN: Failed to link file: %s", file)
continue
if fileExtension in mediaContainer: # If the file is a video file
if is_sample(filePath, inputName, minSampleSize, SampleIDs) and not inputCategory in hpCategory: # Ignore samples
Logger.info("MAIN: Ignoring sample file: %s ", filePath)
@ -223,7 +212,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
flatten(outputDestination)
# Now check if movie files exist in destination:
if inputCategory in cpsCategory + sbCategory and not (inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT):
if inputCategory in cpsCategory + sbCategory:
for dirpath, dirnames, filenames in os.walk(outputDestination):
for file in filenames:
filePath = os.path.join(dirpath, file)
@ -243,10 +232,6 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
else:
Logger.debug("MAIN: Found %s media files in output. %s were found in input", str(video2), str(video))
if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT:
if len(copy_list) > 0:
Logger.debug("MAIN: Found and linked %s files", str(len(copy_list)))
status = int(0)
processCategories = cpsCategory + sbCategory + hpCategory + mlCategory + gzCategory
@ -449,7 +434,7 @@ if __name__ == "__main__":
cpsCategory = (config().get("CouchPotato", "cpsCategory")).split(',') # movie
sbCategory = (config().get("SickBeard", "sbCategory")).split(',') # tv
Torrent_ForceLink = int(config().get("SickBeard", "Torrent_ForceLink")) # 1
Torrent_NoLink = int(config().get("SickBeard", "Torrent_NoLink")) # 0
hpCategory = (config().get("HeadPhones", "hpCategory")).split(',') # music
mlCategory = (config().get("Mylar", "mlCategory")).split(',') # comics
gzCategory = (config().get("Gamez", "gzCategory")).split(',') # games

View file

@ -98,6 +98,10 @@ def processEpisode(dirName, nzbName=None, failed=False, clientAgent = "manual",
process_method = config().get(section, "process_method")
except config.NoOptionError:
process_method = None
try:
Torrent_NoLink = int(config().get(section, "Torrent_NoLink"))
except (config.NoOptionError, ValueError):
Torrent_NoLink = 0
mediaContainer = (config().get("Extensions", "mediaExtensions")).split(',')
minSampleSize = int(config().get("Extensions", "minSampleSize"))
@ -160,7 +164,9 @@ def processEpisode(dirName, nzbName=None, failed=False, clientAgent = "manual",
params[param] = dirName
if param == "process_method":
if process_method:
if fork in SICKBEARD_TORRENT and Torrent_NoLink == 1 and not clientAgent in ['nzbget','sabnzbd']: #use default SickBeard settings here.
del params[param]
elif process_method:
params[param] = process_method
else:
del params[param]

View file

@ -31,6 +31,8 @@ def migrate():
value = "auto"
if option == "fork" and value not in ["default", "failed", "failed-torrent", "auto"]:
value = "auto"
if option == "Torrent_ForceLink":
continue
if option == "outputDirectory": # move this to new location format
value = os.path.split(os.path.normpath(value))[0]
confignew.set("Torrent", option, value)

View file

@ -37,7 +37,7 @@ watch_dir =
fork = auto
delete_failed = 0
nzbExtractionBy = Downloader
Torrent_ForceLink = 1
Torrent_NoLink = 0
process_method =