diff -r f5f7abc760aa -r 293e6c9546e5 gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Wed May 30 23:14:38 2007 +0100 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Fri Jun 01 15:24:34 2007 +0100 @@ -3,9 +3,10 @@ __author__ = "Renato Filho" __author_email__ = "renato.filho@indt.org.br" __license__ = "GPL" -__version__ = "0.1" +__version__ = "0.2" import os +import sys import shlex import signal import subprocess @@ -51,7 +52,14 @@ def start(self, outfd): self.opts.append (self.gmencoder_path) self._parser_params () - self._insert_param ("-o", "fd://%d" % outfd.fileno()) + + outfile = self.params_first("outfile", None) + + if outfile: + path = os.path.join(sys.path[0], ".transcoded", outfile) + self._insert_param("-o", "file://%s" % path) + else: + self._insert_param ("-o", "fd://%d" % outfd.fileno()) cmd = " ".join(self.opts) self.log.info(self.tid, "GMencoder: %s" % cmd) @@ -60,9 +68,13 @@ self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE, stdout=subprocess.PIPE) except Exception, e: - self.log.error(self.tid, "Error executing GMencoder: %s" % e) + self.log.error(self.tid, "Error: executing GMencoder: %s" % e) + outfd.write("Error: GMencoder: %s" % e) return False + if outfile: + outfd.write("OK ") + try: while (self.proc and self.proc.poll() == None): r, w, x = select.select([self.proc.stdout], [], [], 0) @@ -75,6 +87,7 @@ self.log.error(self.tid, "Problems handling data: %s" % e) return False + self.log.info(self.tid, "OK: Done") return True # start()