Fixes extraction issues and occasionally not locating mediafiles

This commit is contained in:
echel0n 2014-04-23 20:41:55 -07:00
commit 4bd04436bc
2 changed files with 11 additions and 12 deletions

View file

@ -47,6 +47,9 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
try:Torrent_NoLink = int(nzbtomedia.CFG[section][inputCategory]["Torrent_NoLink"]) try:Torrent_NoLink = int(nzbtomedia.CFG[section][inputCategory]["Torrent_NoLink"])
except:Torrent_NoLink = 0 except:Torrent_NoLink = 0
try:extract = int(nzbtomedia.CFG[section][inputCategory]['extract'])
except:extract = 0
if clientAgent != 'manual': if clientAgent != 'manual':
nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName) nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName)
@ -120,22 +123,15 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
if not inputCategory in nzbtomedia.NOFLATTEN: #don't flatten hp in case multi cd albums, and we need to copy this back later. if not inputCategory in nzbtomedia.NOFLATTEN: #don't flatten hp in case multi cd albums, and we need to copy this back later.
nzbtomedia.flatten(outputDestination) nzbtomedia.flatten(outputDestination)
if nzbtomedia.CFG[section][inputCategory]['extract'] == 1: if extract == 1:
logger.debug('Checking for archives to extract in directory: %s' % (outputDestination)) logger.debug('Checking for archives to extract in directory: %s' % (outputDestination))
nzbtomedia.extractFiles(outputDestination) nzbtomedia.extractFiles(outputDestination)
# Now check if video files exist in destination: # Now check if video files exist in destination:
if nzbtomedia.CFG["SickBeard","NzbDrone", "CouchPotato"][inputCategory]: if nzbtomedia.CFG["SickBeard","NzbDrone", "CouchPotato"][inputCategory]:
for outputFile in nzbtomedia.listMediaFiles(outputDestination): numVideos = len(nzbtomedia.listMediaFiles(outputDestination, media=True, audio=False, meta=False, archives=False))
fullFileName = os.path.basename(outputFile) if numVideos > 0:
fileName, fileExt = os.path.splitext(fullFileName) logger.info("Found %s media files in %s" % (numVideos, outputDestination))
if fileExt in nzbtomedia.MEDIACONTAINER:
logger.debug("Found media file: %s" % (fullFileName))
video += 1
if video > 0:
logger.debug("Found %s media files" % (str(video)))
status = 0 status = 0
else: else:
logger.warning("Found no media files in %s" % outputDestination) logger.warning("Found no media files in %s" % outputDestination)

View file

@ -305,7 +305,10 @@ def process(inputDirectory, inputName=None, status=0, clientAgent='manual', down
# auto-detect section # auto-detect section
section = nzbtomedia.CFG.findsection(inputCategory) section = nzbtomedia.CFG.findsection(inputCategory)
if section: if section:
if nzbtomedia.CFG[section][inputCategory]['extract'] == 1: try:extract = int(nzbtomedia.CFG[section][inputCategory]['extract'])
except:extract = 0
if extract == 1:
logger.debug('Checking for archives to extract in directory: %s' % (inputDirectory)) logger.debug('Checking for archives to extract in directory: %s' % (inputDirectory))
extractFiles(inputDirectory) extractFiles(inputDirectory)