Fixed torrent file handling

torrents sometimes comes as single file,
however, processors (Sickbeard for example) are expecting isolated
folder.

This patch will make sure that if processed item is not a directory,
then it will create a directory (similar to file name) and move
the media there.
This commit is contained in:
Hagai Cohen 2015-09-24 21:21:49 +03:00
commit 96dfe7d765

View file

@ -97,7 +97,12 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
if clientAgent != 'manual':
core.pause_torrent(clientAgent, inputHash, inputID, inputName)
if uniquePath:
# Incase input is not directory, make sure to create one.
# This way Processing is isolated.
if not os.path.isdir(os.path.join(inputDirectory, inputName)):
basename = os.path.splitext(core.sanitizeName(inputName))[0]
outputDestination = os.path.join(core.OUTPUTDIRECTORY, inputCategory, basename)
elif uniquePath:
outputDestination = os.path.normpath(
core.os.path.join(core.OUTPUTDIRECTORY, inputCategory, core.sanitizeName(inputName)))
else: