added Torrent_ForceLink. fixes #262

This commit is contained in:
clinton-hall 2014-02-17 07:28:40 +10:30
commit 52f5715405
2 changed files with 24 additions and 5 deletions

View file

@ -43,7 +43,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
Logger.debug("MAIN: Determined Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory)
if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT:
if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT and Torrent_ForceLink != 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:
@ -127,8 +127,11 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
noFlatten.extend(hpCategory) # Make sure we preserve folder structure for HeadPhones.
if useLink in ['sym','move']: # These don't work for HeadPhones.
useLink = 'no' # default to copy.
if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT: # Don't flatten when sending to SICKBEARD_TORRENT
noFlatten.extend(inputCategory)
outputDestinationMaster = outputDestination # Save the original, so we can cahnge this within the lopp below, and reset afterwards.
outputDestinationMaster = outputDestination # Save the original, so we can change this within the loop below, and reset afterwards.
now = datetime.datetime.now()
for dirpath, dirnames, filenames in os.walk(inputDirectory):
for file in filenames:
@ -166,13 +169,22 @@ 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)
continue
else:
video = video + 1
Logger.info("MAIN: Found video file %s in %s", fileExtension, filePath)
Logger.info("MAIN: Found media file %s in %s", fileExtension, filePath)
try:
copy_link(filePath, targetDirectory, useLink, outputDestination)
copy_list.append([filePath, os.path.join(outputDestination, file)])
@ -227,7 +239,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
flatten(outputDestination)
# Now check if movie files exist in destination:
if inputCategory in cpsCategory + sbCategory:
if inputCategory in cpsCategory + sbCategory and not (inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT):
for dirpath, dirnames, filenames in os.walk(outputDestination):
for file in filenames:
filePath = os.path.join(dirpath, file)
@ -247,6 +259,11 @@ 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
if (inputCategory in user_script_categories and not "NONE" in user_script_categories) or ("ALL" in user_script_categories and not inputCategory in processCategories):
@ -473,7 +490,8 @@ if __name__ == "__main__":
cpsCategory = (config.get("CouchPotato", "cpsCategory")).split(',') # movie
sbCategory = (config.get("SickBeard", "sbCategory")).split(',') # tv
sbFork = config.get("SickBeard", "fork") # tv
sbFork = config.get("SickBeard", "fork") # default
Torrent_ForceLink = int(config.get("SickBeard", "Torrent_ForceLink")) # 1
hpCategory = (config.get("HeadPhones", "hpCategory")).split(',') # music
mlCategory = (config.get("Mylar", "mlCategory")).split(',') # comics
gzCategory = (config.get("Gamez", "gzCategory")).split(',') # games

View file

@ -36,6 +36,7 @@ watch_dir =
fork = default
delete_failed = 0
nzbExtractionBy = Downloader
Torrent_ForceLink = 1
[HeadPhones]