1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-25 09:11:46 +00:00

FIX:(#870) Post-Processing with metadata would fail when attempting to run external command during metatagging (windows systems only)

This commit is contained in:
evilhero 2014-10-29 14:23:33 -04:00
parent 2f59e495dc
commit 08c364b5ee

View file

@ -31,6 +31,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None, module
if platform.system() == "Windows": if platform.system() == "Windows":
#if it's a source install. #if it's a source install.
sys_type = 'windows'
if os.path.isdir(os.path.join(mylar.CMTAGGER_PATH, '.git')): if os.path.isdir(os.path.join(mylar.CMTAGGER_PATH, '.git')):
comictagger_cmd = os.path.join(mylar.CMTAGGER_PATH, 'comictagger.py') comictagger_cmd = os.path.join(mylar.CMTAGGER_PATH, 'comictagger.py')
@ -57,7 +58,9 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None, module
logger.fdebug(module + ' UNRAR path set to : ' + unrar_cmd) logger.fdebug(module + ' UNRAR path set to : ' + unrar_cmd)
elif platform.system() == "Darwin": #Mac OS X elif platform.system() == "Darwin":
#Mac OS X
sys_type = 'mac'
comictagger_cmd = os.path.join(mylar.CMTAGGER_PATH, 'comictagger.py') comictagger_cmd = os.path.join(mylar.CMTAGGER_PATH, 'comictagger.py')
if mylar.UNRAR_CMD == 'None' or mylar.UNRAR_CMD == '' or mylar.UNRAR_CMD is None: if mylar.UNRAR_CMD == 'None' or mylar.UNRAR_CMD == '' or mylar.UNRAR_CMD is None:
unrar_cmd = "/usr/local/bin/unrar" unrar_cmd = "/usr/local/bin/unrar"
@ -68,6 +71,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None, module
else: else:
#for the 'nix #for the 'nix
sys_type = 'linux'
if mylar.UNRAR_CMD == 'None' or mylar.UNRAR_CMD == '' or mylar.UNRAR_CMD is None: if mylar.UNRAR_CMD == 'None' or mylar.UNRAR_CMD == '' or mylar.UNRAR_CMD is None:
if 'freebsd' in platform.linux_distribution()[0].lower(): if 'freebsd' in platform.linux_distribution()[0].lower():
unrar_cmd = "/usr/local/bin/unrar" unrar_cmd = "/usr/local/bin/unrar"
@ -300,7 +304,11 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None, module
tagoptions = [ "-s", "--verbose" ] tagoptions = [ "-s", "--verbose" ]
## check comictagger version - less than 1.15.beta - take your chances. ## check comictagger version - less than 1.15.beta - take your chances.
if sys_type == 'windows':
ctversion = subprocess.check_output( [ comictagger_cmd, "--version" ] )
else:
ctversion = subprocess.check_output( [ sys.executable, comictagger_cmd, "--version" ] ) ctversion = subprocess.check_output( [ sys.executable, comictagger_cmd, "--version" ] )
ctend = ctversion.find(':') ctend = ctversion.find(':')
ctcheck = re.sub("[^0-9]", "", ctversion[:ctend]) ctcheck = re.sub("[^0-9]", "", ctversion[:ctend])
ctcheck = re.sub('\.', '', ctcheck).strip() ctcheck = re.sub('\.', '', ctcheck).strip()
@ -373,7 +381,9 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None, module
#CV API Check here. #CV API Check here.
if mylar.CVAPI_COUNT == 0 or mylar.CVAPI_COUNT >= 200: if mylar.CVAPI_COUNT == 0 or mylar.CVAPI_COUNT >= 200:
cvapi_check() cvapi_check()
if sys_type == 'windows':
currentScriptName = str(comictagger_cmd).decode("string_escape")
else:
currentScriptName = sys.executable + ' ' + str(comictagger_cmd).decode("string_escape") currentScriptName = sys.executable + ' ' + str(comictagger_cmd).decode("string_escape")
logger.fdebug(module + ' Enabling ComicTagger script: ' + str(currentScriptName) + ' with options: ' + str(f_tagoptions)) logger.fdebug(module + ' Enabling ComicTagger script: ' + str(currentScriptName) + ' with options: ' + str(f_tagoptions))
# generate a safe command line string to execute the script and provide all the parameters # generate a safe command line string to execute the script and provide all the parameters