[svn r831] fixed bug on transcode file trunk
authormelunko
Thu Aug 23 22:30:57 2007 +0100 (2007-08-23)
branchtrunk
changeset 82532ec09590cf2
parent 824 e711a64ba03d
child 826 e0152712fd4f
[svn r831] fixed bug on transcode file
gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py
     1.1 --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Thu Aug 23 20:24:11 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Thu Aug 23 22:30:57 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()