mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -07:00
added Torrent_ForceLink. fixes #262
This commit is contained in:
parent
93f2f75cdc
commit
52f5715405
2 changed files with 24 additions and 5 deletions
|
@ -43,7 +43,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
|
|
||||||
Logger.debug("MAIN: Determined Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory)
|
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)
|
Logger.info("MAIN: Calling SickBeard's %s branch to post-process: %s",sbFork ,inputName)
|
||||||
result = autoProcessTV.processEpisode(inputDirectory, inputName, int(0))
|
result = autoProcessTV.processEpisode(inputDirectory, inputName, int(0))
|
||||||
if result == 1:
|
if result == 1:
|
||||||
|
@ -128,7 +128,10 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
if useLink in ['sym','move']: # These don't work for HeadPhones.
|
if useLink in ['sym','move']: # These don't work for HeadPhones.
|
||||||
useLink = 'no' # default to copy.
|
useLink = 'no' # default to copy.
|
||||||
|
|
||||||
outputDestinationMaster = outputDestination # Save the original, so we can cahnge this within the lopp below, and reset afterwards.
|
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 change this within the loop below, and reset afterwards.
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
for dirpath, dirnames, filenames in os.walk(inputDirectory):
|
for dirpath, dirnames, filenames in os.walk(inputDirectory):
|
||||||
for file in filenames:
|
for file in filenames:
|
||||||
|
@ -166,13 +169,22 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
else:
|
else:
|
||||||
continue # This file has not been recently moved or created, skip it
|
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 fileExtension in mediaContainer: # If the file is a video file
|
||||||
if is_sample(filePath, inputName, minSampleSize, SampleIDs) and not inputCategory in hpCategory: # Ignore samples
|
if is_sample(filePath, inputName, minSampleSize, SampleIDs) and not inputCategory in hpCategory: # Ignore samples
|
||||||
Logger.info("MAIN: Ignoring sample file: %s ", filePath)
|
Logger.info("MAIN: Ignoring sample file: %s ", filePath)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
video = video + 1
|
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:
|
try:
|
||||||
copy_link(filePath, targetDirectory, useLink, outputDestination)
|
copy_link(filePath, targetDirectory, useLink, outputDestination)
|
||||||
copy_list.append([filePath, os.path.join(outputDestination, file)])
|
copy_list.append([filePath, os.path.join(outputDestination, file)])
|
||||||
|
@ -227,7 +239,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
flatten(outputDestination)
|
flatten(outputDestination)
|
||||||
|
|
||||||
# Now check if movie files exist in destination:
|
# 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 dirpath, dirnames, filenames in os.walk(outputDestination):
|
||||||
for file in filenames:
|
for file in filenames:
|
||||||
filePath = os.path.join(dirpath, file)
|
filePath = os.path.join(dirpath, file)
|
||||||
|
@ -247,6 +259,11 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
else:
|
else:
|
||||||
Logger.debug("MAIN: Found %s media files in output. %s were found in input", str(video2), str(video))
|
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
|
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):
|
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
|
cpsCategory = (config.get("CouchPotato", "cpsCategory")).split(',') # movie
|
||||||
sbCategory = (config.get("SickBeard", "sbCategory")).split(',') # tv
|
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
|
hpCategory = (config.get("HeadPhones", "hpCategory")).split(',') # music
|
||||||
mlCategory = (config.get("Mylar", "mlCategory")).split(',') # comics
|
mlCategory = (config.get("Mylar", "mlCategory")).split(',') # comics
|
||||||
gzCategory = (config.get("Gamez", "gzCategory")).split(',') # games
|
gzCategory = (config.get("Gamez", "gzCategory")).split(',') # games
|
||||||
|
|
|
@ -36,6 +36,7 @@ watch_dir =
|
||||||
fork = default
|
fork = default
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
nzbExtractionBy = Downloader
|
nzbExtractionBy = Downloader
|
||||||
|
Torrent_ForceLink = 1
|
||||||
|
|
||||||
|
|
||||||
[HeadPhones]
|
[HeadPhones]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue