We now append the torrent info hash to the output destination folder name, this allows us to re-use it for manual runs if something failed during the post-processing or other future uses.

This commit is contained in:
echel0n 2014-04-22 02:53:39 -07:00
commit eeca672e00
3 changed files with 17 additions and 5 deletions

View file

@ -15,7 +15,7 @@ from nzbtomedia.autoProcess.autoProcessMusic import autoProcessMusic
from nzbtomedia.autoProcess.autoProcessTV import autoProcessTV from nzbtomedia.autoProcess.autoProcessTV import autoProcessTV
from nzbtomedia.nzbToMediaUtil import category_search, sanitizeFileName, copy_link, parse_args, flatten, get_dirnames, \ from nzbtomedia.nzbToMediaUtil import category_search, sanitizeFileName, copy_link, parse_args, flatten, get_dirnames, \
remove_read_only, pause_torrent, resume_torrent, listMediaFiles, joinPath, \ remove_read_only, pause_torrent, resume_torrent, listMediaFiles, joinPath, \
extractFiles, cleanProcDirs extractFiles, cleanProcDirs, append_downloadID
from nzbtomedia import logger from nzbtomedia import logger
def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, clientAgent): def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, clientAgent):
@ -48,6 +48,12 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
if inputCategory == "": if inputCategory == "":
inputCategory = "UNCAT" inputCategory = "UNCAT"
outputDestination = os.path.normpath(joinPath(nzbtomedia.OUTPUTDIRECTORY, inputCategory, sanitizeFileName(inputName))) outputDestination = os.path.normpath(joinPath(nzbtomedia.OUTPUTDIRECTORY, inputCategory, sanitizeFileName(inputName)))
# Add torrent info hash to folder name incase we need it later on
if clientAgent != 'manual':
logger.debug('Added torrent info hash %s to output directory %s' % (inputHash, outputDestination))
outputDestination = append_downloadID(outputDestination, inputHash)
logger.info("Output directory set to: %s" % (outputDestination)) logger.info("Output directory set to: %s" % (outputDestination))
processOnly = nzbtomedia.CFG[nzbtomedia.SECTIONS].sections processOnly = nzbtomedia.CFG[nzbtomedia.SECTIONS].sections
@ -152,10 +158,10 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
logger.error("Something failed! Please check logs. Exiting") logger.error("Something failed! Please check logs. Exiting")
return status return status
if nzbtomedia.CFG['CouchPotato'][inputCategory]: if nzbtomedia.CFG['CouchPotato'][inputCategory]:
logger.info("Calling CouchPotato:" + inputCategory + " to post-process: %s" % (inputName)) logger.info("Calling CouchPotato:" + inputCategory + " to post-process: %s" % (inputName))
download_id = inputHash result = autoProcessMovie().process(outputDestination, inputName, status, clientAgent, inputHash, inputCategory)
result = autoProcessMovie().process(outputDestination, inputName, status, clientAgent, download_id, inputCategory)
elif nzbtomedia.CFG['SickBeard'][inputCategory]: elif nzbtomedia.CFG['SickBeard'][inputCategory]:
logger.info("Calling Sick-Beard:" + inputCategory + " to post-process: %s" % (inputName)) logger.info("Calling Sick-Beard:" + inputCategory + " to post-process: %s" % (inputName))
result = autoProcessTV().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory) result = autoProcessTV().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory)

View file

@ -701,4 +701,7 @@ def extractFiles(src, dst=None):
os.remove(inputFile) os.remove(inputFile)
time.sleep(1) time.sleep(1)
except: except:
logger.debug("Unable to remove file %s" % (inputFile)) logger.debug("Unable to remove file %s" % (inputFile))
def append_downloadID(dirName, download_id):
return '%s.downloadID(%s)' % (dirName,download_id)

View file

@ -1,9 +1,12 @@
import nzbtomedia import nzbtomedia
from nzbtomedia.nzbToMediaUtil import extractFiles from nzbtomedia.nzbToMediaUtil import extractFiles, append_downloadID
# Initialize the config # Initialize the config
nzbtomedia.initialize() nzbtomedia.initialize()
inputDirectory = "Z:\complete\tv\Game.of.Thrones.S04E03.HDTV.XviD-RARBG" inputDirectory = "Z:\complete\tv\Game.of.Thrones.S04E03.HDTV.XviD-RARBG"
inputName = "Game of Thrones - S04E03 - Breaker of Chains" inputName = "Game of Thrones - S04E03 - Breaker of Chains"
inputHash = 'wdfc8fdn09w1wn908ede0820d8berd434213'
outputDestination = append_downloadID(inputDirectory, inputHash)
print outputDestination