From 7cbb44b0131883bb122d23cb6196d71de22b0fa1 Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Mon, 1 Apr 2013 03:15:20 -0700 Subject: [PATCH] only find parts when more than 1 fix #105 --- TorrentToMedia.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index ab36d6e3..0cd730a3 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -33,6 +33,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash): video2 = int(0) foundFile = int(0) deleteOriginal = int(0) + numCompressed = int(0) extractionSuccess = False Logger.debug("MAIN: Received Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory) @@ -101,7 +102,8 @@ def main(inputDirectory, inputName, inputCategory, inputHash): Logger.error("MAIN: Failed to link file: %s", file) Logger.debug(e) elif fileExtension in compressedContainer: - if re.search(r'\d+', os.path.splitext(fileName)[1]): # find part numbers in second "extension" from right + numCompressed = numCompressed + 1 + if re.search(r'\d+', os.path.splitext(fileName)[1]) and numCompressed > 1: # find part numbers in second "extension" from right, if we have more than 1 compressed file. part = int(re.search(r'\d+', os.path.splitext(fileName)[1]).group()) if part == 1: # we only want to extract the primary part. Logger.debug("MAIN: Found primary part of a multi-part archive %s. Extracting", file)