# HG changeset patch # User melunko # Date 1187904657 -3600 # Node ID 32ec09590cf2767f1582b31f350899e9fe81cc95 # Parent e711a64ba03d50df10927b7a6473bdcdcc2d64fd [svn r831] fixed bug on transcode file diff -r e711a64ba03d -r 32ec09590cf2 gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Thu Aug 23 20:24:11 2007 +0100 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Thu Aug 23 22:30:57 2007 +0100 @@ -72,15 +72,20 @@ try: self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + + if outfile: + outfd.write("OK ") + except Exception, e: self.log.error(self.tid, "Error: executing GMencoder: %s" % e) outfd.write("Error: GMencoder: %s" % e) return False try: - p = select.poll() - #print outfd.fileno() - p.register (outfd, select.POLLNVAL | select.POLLERR | select.POLLHUP | select.POLLIN ) + if not outfile: + p = select.poll() + p.register (outfd, select.POLLNVAL | select.POLLERR | select.POLLHUP | select.POLLIN ) + while (self.proc and self.proc.poll() == None): r, w, x = select.select([self.proc.stdout], [], [], 1) if self.proc.stdout in r: @@ -90,11 +95,12 @@ elif (progress.find ("Erro") >= 0): return False - ret = p.poll(0) - if ret: - print "Lost Connection" - self.stop () - return False + if not outfile: + ret = p.poll(0) + if ret: + print "Lost Connection" + self.stop () + return False except Exception, e: self.log.error(self.tid, "Problems handling data: %s" % e) @@ -102,8 +108,6 @@ self.status = 100; - if outfile: - outfd.write("OK ") return True # start()