mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
Only extract part1 of multipart. fixes #100
This commit is contained in:
parent
ed92cb4e4b
commit
fee3ec2897
1 changed files with 9 additions and 1 deletions
|
@ -30,6 +30,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash):
|
|||
root = int(0)
|
||||
video = int(0)
|
||||
video2 = int(0)
|
||||
num_compressed = int(0)
|
||||
extractionSuccess = False
|
||||
|
||||
Logger.debug("MAIN: Received Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory)
|
||||
|
@ -51,7 +52,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash):
|
|||
for file in filenames:
|
||||
|
||||
filePath = os.path.join(dirpath, file)
|
||||
fileExtension = os.path.splitext(file)[1]
|
||||
fileName, fileExtension = os.path.splitext(file)
|
||||
targetDirectory = os.path.join(outputDestination, file)
|
||||
|
||||
if root == 1:
|
||||
|
@ -95,6 +96,13 @@ 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
|
||||
part = int(re.search(r'\d+', os.path.splitext(fileName)[1]).group())
|
||||
if part == 1: # we only want to extract the primary part.
|
||||
Logger.info("MAIN: Found primary part of a multi-part archive %s. Extracting", file)
|
||||
else:
|
||||
Logger.info("MAIN: Found part %s of a multi-part archive %s. Ignoring", part, file)
|
||||
continue
|
||||
Logger.info("MAIN: Found compressed archive %s for file %s", fileExtension, filePath)
|
||||
try:
|
||||
extractor.extract(filePath, outputDestination)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue