mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
fix for logging and windows
This commit is contained in:
parent
1a5e697148
commit
5fc55fb0da
1 changed files with 8 additions and 5 deletions
|
@ -1,8 +1,9 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
from subprocess import call
|
||||||
|
|
||||||
Logger = logging.getLogger(__name__)
|
Logger = logging.getLogger()
|
||||||
|
|
||||||
# which() and os_platform() breaks when running in Transmission (has to do with os.environ)
|
# which() and os_platform() breaks when running in Transmission (has to do with os.environ)
|
||||||
|
|
||||||
|
@ -40,8 +41,10 @@ def extract(dirpath, file, outputDestination):
|
||||||
platform = 'x64'
|
platform = 'x64'
|
||||||
else:
|
else:
|
||||||
platform = 'x86'
|
platform = 'x86'
|
||||||
|
if not os.path.dirname(sys.argv[0]):
|
||||||
sevenzipLocation = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), 'extractor/bin/' + platform + '/7z.exe'))
|
sevenzipLocation = os.path.normpath(os.path.join(os.getcwd(), 'extractor/bin/' + platform + '/7z.exe'))
|
||||||
|
else:
|
||||||
|
sevenzipLocation = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), 'extractor/bin/' + platform + '/7z.exe'))
|
||||||
if not os.path.exists(sevenzipLocation):
|
if not os.path.exists(sevenzipLocation):
|
||||||
Logger.error("EXTRACTOR: Couldnt find 7-zip, Exiting")
|
Logger.error("EXTRACTOR: Couldnt find 7-zip, Exiting")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
@ -113,7 +116,7 @@ def extract(dirpath, file, outputDestination):
|
||||||
else:
|
else:
|
||||||
Logger.info("EXTRACTOR: Extraction failed for %s. 7zip result was %s", filePath, res)
|
Logger.info("EXTRACTOR: Extraction failed for %s. 7zip result was %s", filePath, res)
|
||||||
except:
|
except:
|
||||||
Logger.error("EXTRACTOR: Extraction failed for %s. Could not call command %s %s", filePath, run)
|
Logger.error("EXTRACTOR: Extraction failed for %s. Could not call command %s", filePath, run)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
if cmd[1] == "": # If calling unzip, we dont want to pass the ""
|
if cmd[1] == "": # If calling unzip, we dont want to pass the ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue