From b5ee0c241ca536d44d63f31869553da73e6b8beb Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Thu, 12 Apr 2018 21:31:59 +1200 Subject: [PATCH] added check for single file Torrent. Fixes #924 --- TorrentToMedia.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 3dd7580a..9fdbd587 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -142,7 +142,11 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, inputFiles = core.listMediaFiles(inputDirectory, archives=False, other=True, otherext=extensions) else: inputFiles = core.listMediaFiles(inputDirectory, other=True, otherext=extensions) - logger.debug("Found {0} files in {1}".format(len(inputFiles), inputDirectory)) + if len(inputFiles) == 0 and os.path.isfile(inputDirectory): + inputFiles = [inputDirectory] + logger.debug("Found 1 file to process: {0}".format(inputDirectory)) + else: + logger.debug("Found {0} files in {1}".format(len(inputFiles), inputDirectory)) for inputFile in inputFiles: filePath = os.path.dirname(inputFile) fileName, fileExt = os.path.splitext(os.path.basename(inputFile))