[svn r741] * GMyth-Streamer trunk
authormorphbr
Fri Jun 01 11:50:11 2007 +0100 (2007-06-01)
branchtrunk
changeset 73515a191556cd6
parent 734 258959fbb3ec
child 736 1bc4c47e4ad8
[svn r741] * GMyth-Streamer
- gmencoder outfile support
gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py
gmyth-stream/server/0.3/plugins/transcoders/mencoder.py
     1.1 --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Thu May 31 20:45:06 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Fri Jun 01 11:50:11 2007 +0100
     1.3 @@ -3,9 +3,10 @@
     1.4  __author__ = "Renato Filho"
     1.5  __author_email__ = "renato.filho@indt.org.br"
     1.6  __license__ = "GPL"
     1.7 -__version__ = "0.1"
     1.8 +__version__ = "0.2"
     1.9  
    1.10  import os
    1.11 +import sys
    1.12  import shlex
    1.13  import signal
    1.14  import subprocess
    1.15 @@ -51,7 +52,14 @@
    1.16      def start(self, outfd):
    1.17          self.opts.append (self.gmencoder_path)
    1.18          self._parser_params ()
    1.19 -        self._insert_param ("-o", "fd://%d" % outfd.fileno())
    1.20 +
    1.21 +        outfile = self.params_first("outfile", None)
    1.22 +
    1.23 +        if outfile:
    1.24 +            path = os.path.join(sys.path[0], ".transcoded", outfile)
    1.25 +            self._insert_param("-o", "file://%s" % path)
    1.26 +        else:
    1.27 +            self._insert_param ("-o", "fd://%d" % outfd.fileno())
    1.28  
    1.29          cmd = " ".join(self.opts)
    1.30          self.log.info(self.tid, "GMencoder: %s" % cmd)
    1.31 @@ -60,9 +68,13 @@
    1.32              self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE,
    1.33                                           stdout=subprocess.PIPE)
    1.34          except Exception, e:
    1.35 -            self.log.error(self.tid, "Error executing GMencoder: %s" % e)
    1.36 +            self.log.error(self.tid, "Error: executing GMencoder: %s" % e)
    1.37 +            outfd.write("Error: GMencoder: %s" % e)
    1.38              return False
    1.39  
    1.40 +        if outfile:
    1.41 +            outfd.write("OK   ")
    1.42 +
    1.43          try:
    1.44              while (self.proc and self.proc.poll() == None):
    1.45                  r, w, x = select.select([self.proc.stdout], [], [], 0)
    1.46 @@ -75,6 +87,7 @@
    1.47              self.log.error(self.tid, "Problems handling data: %s" % e)
    1.48              return False
    1.49  
    1.50 +        self.log.info(self.tid, "OK: Done")
    1.51          return True
    1.52      # start()
    1.53  
     2.1 --- a/gmyth-stream/server/0.3/plugins/transcoders/mencoder.py	Thu May 31 20:45:06 2007 +0100
     2.2 +++ b/gmyth-stream/server/0.3/plugins/transcoders/mencoder.py	Fri Jun 01 11:50:11 2007 +0100
     2.3 @@ -203,7 +203,6 @@
     2.4              return False
     2.5  
     2.6          stdout = self._check_opened_file(stdw, _stdin)
     2.7 -
     2.8          outfd.write("OK   ")
     2.9  
    2.10          try: