mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
remove call and use popen. #678
This commit is contained in:
parent
41e9ad2fa3
commit
8733655846
2 changed files with 8 additions and 5 deletions
|
@ -392,6 +392,8 @@ def initialize(section=None):
|
||||||
GENERALOPTS = (CFG["Transcoder"]["generalOptions"])
|
GENERALOPTS = (CFG["Transcoder"]["generalOptions"])
|
||||||
if isinstance(GENERALOPTS, str): GENERALOPTS = GENERALOPTS.split(',')
|
if isinstance(GENERALOPTS, str): GENERALOPTS = GENERALOPTS.split(',')
|
||||||
if GENERALOPTS == ['']: GENERALOPTS = []
|
if GENERALOPTS == ['']: GENERALOPTS = []
|
||||||
|
if not '-fflags' in GENERALOPTS: GENERALOPTS.append('-fflags')
|
||||||
|
if not '+genpts' in GENERALOPTS: GENERALOPTS.append('+genpts')
|
||||||
try:
|
try:
|
||||||
OUTPUTQUALITYPERCENT = int(CFG["Transcoder"]["outputQualityPercent"])
|
OUTPUTQUALITYPERCENT = int(CFG["Transcoder"]["outputQualityPercent"])
|
||||||
except: pass
|
except: pass
|
||||||
|
|
|
@ -8,7 +8,6 @@ import nzbtomedia
|
||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
from subprocess import call
|
|
||||||
from nzbtomedia import logger
|
from nzbtomedia import logger
|
||||||
from nzbtomedia.nzbToMediaUtil import makeDir
|
from nzbtomedia.nzbToMediaUtil import makeDir
|
||||||
|
|
||||||
|
@ -534,7 +533,9 @@ def extract_subs(file, newfilePath, bitbucket):
|
||||||
print_cmd(command)
|
print_cmd(command)
|
||||||
result = 1 # set result to failed in case call fails.
|
result = 1 # set result to failed in case call fails.
|
||||||
try:
|
try:
|
||||||
result = call(command, stdout=bitbucket, stderr=bitbucket)
|
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket)
|
||||||
|
proc.communicate()
|
||||||
|
result = proc.returncode
|
||||||
except:
|
except:
|
||||||
logger.error("Extracting subtitle has failed")
|
logger.error("Extracting subtitle has failed")
|
||||||
|
|
||||||
|
@ -725,7 +726,7 @@ def Transcode_directory(dirName):
|
||||||
result = 1 # set result to failed in case call fails.
|
result = 1 # set result to failed in case call fails.
|
||||||
try:
|
try:
|
||||||
if isinstance(file, str):
|
if isinstance(file, str):
|
||||||
result = call(command, stdout=bitbucket, stderr=bitbucket)
|
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket)
|
||||||
else:
|
else:
|
||||||
img, data = file.iteritems().next()
|
img, data = file.iteritems().next()
|
||||||
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket, stdin=subprocess.PIPE)
|
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket, stdin=subprocess.PIPE)
|
||||||
|
@ -734,8 +735,8 @@ def Transcode_directory(dirName):
|
||||||
if procin:
|
if procin:
|
||||||
shutil.copyfileobj(procin.stdout, proc.stdin)
|
shutil.copyfileobj(procin.stdout, proc.stdin)
|
||||||
procin.stdout.close()
|
procin.stdout.close()
|
||||||
proc.communicate()
|
proc.communicate()
|
||||||
result = proc.returncode
|
result = proc.returncode
|
||||||
except:
|
except:
|
||||||
logger.error("Transcoding of video %s has failed" % (newfilePath))
|
logger.error("Transcoding of video %s has failed" % (newfilePath))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue