change to proc.communicate. Fixes #455

This commit is contained in:
clinton-hall 2014-06-29 14:22:27 +09:30
parent 206f7e4c10
commit 16e8be1a35

View file

@ -6,7 +6,6 @@ import urllib2
import traceback import traceback
import nzbtomedia import nzbtomedia
import json import json
import time
from subprocess import call from subprocess import call
from nzbtomedia import logger from nzbtomedia import logger
from nzbtomedia.nzbToMediaUtil import makeDir from nzbtomedia.nzbToMediaUtil import makeDir
@ -47,10 +46,9 @@ def getVideoDetails(videofile):
command = [nzbtomedia.FFPROBE, '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', '-show_error', videofile] command = [nzbtomedia.FFPROBE, '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', '-show_error', videofile]
try: try:
proc = subprocess.Popen(command, stdout=subprocess.PIPE) proc = subprocess.Popen(command, stdout=subprocess.PIPE)
while proc.poll() is None: out, err = proc.communicate()
time.sleep(0.5)
result = proc.returncode result = proc.returncode
video_details = json.loads(proc.stdout.read()) video_details = json.loads(out)
except: except:
logger.error("Checking [%s] has failed" % (videofile), 'TRANSCODER') logger.error("Checking [%s] has failed" % (videofile), 'TRANSCODER')
return video_details, result return video_details, result