mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 22:03:13 -07:00
x64 support on windows
This commit is contained in:
parent
353cfb10f7
commit
f5aa03b73d
6 changed files with 23 additions and 7 deletions
|
@ -304,9 +304,10 @@ for dirpath, dirnames, filenames in os.walk(inputDirectory):
|
|||
Logger.info("MAIN: Found compressed archive %s for file %s", fileExtention, filePath)
|
||||
source = filePath
|
||||
target = os.path.join(outputDestination, file)
|
||||
state = extractor.extract(dirpath, file, outputDestination)
|
||||
if state == False:
|
||||
Logger.info("MAIN: Failed to unpack file %s", file)
|
||||
try:
|
||||
extractor.extract(dirpath, file, outputDestination)
|
||||
except:
|
||||
Logger.warn("Extraction failed")
|
||||
failed_extract = 1
|
||||
else:
|
||||
Logger.info("MAIN: Ignoring unknown filetype %s for file %s", fileExtention, filePath)
|
||||
|
|
BIN
extractor/bin/x64/7z.dll
Normal file
BIN
extractor/bin/x64/7z.dll
Normal file
Binary file not shown.
BIN
extractor/bin/x64/7z.exe
Normal file
BIN
extractor/bin/x64/7z.exe
Normal file
Binary file not shown.
|
@ -4,7 +4,18 @@ import logging
|
|||
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
# which() breaks when running in Transmission (has to do with os.environ["PATH"])
|
||||
# which() and os_platform() breaks when running in Transmission (has to do with os.environ)
|
||||
|
||||
def os_platform():
|
||||
# Author Credit: Matthew Scouten @ http://stackoverflow.com/a/7260315
|
||||
true_platform = os.environ['PROCESSOR_ARCHITECTURE']
|
||||
try:
|
||||
true_platform = os.environ["PROCESSOR_ARCHITEW6432"]
|
||||
except KeyError:
|
||||
pass
|
||||
#true_platform not assigned to if this does not exist
|
||||
return true_platform
|
||||
|
||||
def which(program):
|
||||
# Author Credit: Jay @ http://stackoverflow.com/a/377028
|
||||
def is_exe(fpath):
|
||||
|
@ -25,11 +36,15 @@ def which(program):
|
|||
def extract(dirpath, file, outputDestination):
|
||||
# Using Windows
|
||||
if os.name == 'nt':
|
||||
binLocation = 'extractor/bin/7z.exe' # Only 32bit for now
|
||||
sevenzipLocation = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), binLocation))
|
||||
if os_platform() == 'AMD64':
|
||||
platform = 'x64'
|
||||
else:
|
||||
platform = 'x86'
|
||||
|
||||
sevenzipLocation = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), 'extractor/bin/' + platform + '/7z.exe'))
|
||||
if not os.path.exists(sevenzipLocation):
|
||||
Logger.error("EXTRACTOR: Couldnt find 7-zip, Exiting")
|
||||
sys.exit(-1)
|
||||
sys.exit(-1)
|
||||
else:
|
||||
cmd_7zip = [sevenzipLocation, 'x -y']
|
||||
ext_7zip = [".rar",".zip",".tar.gz","tgz",".tar.bz2",".tbz",".tar.lzma",".tlz",".7z",".xz"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue