gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py
branchtrunk
changeset 830 0e159c5e2d32
parent 815 7f290a3a34b1
     1.1 --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Tue Aug 21 16:04:44 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Wed Aug 29 10:00:25 2007 +0100
     1.3 @@ -72,15 +72,20 @@
     1.4          try:
     1.5              self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE,
     1.6                                           stdout=subprocess.PIPE)
     1.7 +
     1.8 +	    if outfile:
     1.9 +           	outfd.write("OK   ")
    1.10 +
    1.11          except Exception, e:
    1.12              self.log.error(self.tid, "Error: executing GMencoder: %s" % e)
    1.13              outfd.write("Error: GMencoder: %s" % e)
    1.14              return False
    1.15  
    1.16          try:
    1.17 -	    p = select.poll()
    1.18 -	    #print outfd.fileno()
    1.19 -	    p.register (outfd, select.POLLNVAL | select.POLLERR | select.POLLHUP | select.POLLIN )
    1.20 +	    if not outfile:
    1.21 +	    	p = select.poll()
    1.22 +	    	p.register (outfd, select.POLLNVAL | select.POLLERR | select.POLLHUP | select.POLLIN )
    1.23 +
    1.24              while (self.proc and self.proc.poll() == None):
    1.25                  r, w, x = select.select([self.proc.stdout], [], [], 1)
    1.26                  if self.proc.stdout in r:
    1.27 @@ -90,11 +95,12 @@
    1.28  		    elif (progress.find ("Erro") >= 0):
    1.29  			return False
    1.30  
    1.31 -		    ret = p.poll(0)
    1.32 -		    if ret:
    1.33 -		    	print "Lost Connection"
    1.34 -		    	self.stop ()
    1.35 -		    	return False
    1.36 +		    if not outfile:
    1.37 +			    ret = p.poll(0)
    1.38 +			    if ret:
    1.39 +			    	print "Lost Connection"
    1.40 +		    		self.stop ()
    1.41 +			    	return False
    1.42  
    1.43          except Exception, e:
    1.44              self.log.error(self.tid, "Problems handling data: %s" % e)
    1.45 @@ -102,8 +108,6 @@
    1.46  
    1.47          self.status = 100;
    1.48  
    1.49 -        if outfile:
    1.50 -           outfd.write("OK   ")
    1.51  
    1.52          return True
    1.53      # start()