[svn r781] - More bug fixes to file_info trunk
authormorphbr
Wed Jul 04 09:09:48 2007 +0100 (2007-07-04)
branchtrunk
changeset 7757cd98c74da22
parent 774 366b0fd1eead
child 776 9add73d88bce
[svn r781] - More bug fixes to file_info
gmyth-stream/server/0.3/lib/file_handler.py
gmyth-stream/server/0.3/lib/request_handler.py
gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py
     1.1 --- a/gmyth-stream/server/0.3/lib/file_handler.py	Wed Jul 04 08:38:36 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/lib/file_handler.py	Wed Jul 04 09:09:48 2007 +0100
     1.3 @@ -8,6 +8,7 @@
     1.4  import os
     1.5  import sys
     1.6  import pickle
     1.7 +import logging
     1.8  import lib.utils as utils
     1.9  
    1.10  from stat import *
    1.11 @@ -18,6 +19,7 @@
    1.12  class TranscodedFile(object):
    1.13      """This class creates and reads information about transcoded files."""
    1.14      opts = {}
    1.15 +    log = logging.getLogger("gms.file_handler")
    1.16  
    1.17      def __init__(self, filename, args):
    1.18          if filename == "" or not os.path.exists(filename):
    1.19 @@ -28,7 +30,7 @@
    1.20                      self.opts["uri"][0])
    1.21  
    1.22              name = os.path.basename(self.opts["uri"][0])
    1.23 -            self.opts["original"] = name
    1.24 +            self.opts["original"] = ["%s"] % name
    1.25              output_file = os.path.basename(self.opts["outfile"][0])
    1.26              output = open(".transcoded/%s.dat" % \
    1.27                            os.path.splitext(output_file)[0], "wb")
    1.28 @@ -36,7 +38,7 @@
    1.29              pickle.dump(self.opts, output, -1)
    1.30              output.close()
    1.31          else:
    1.32 -            name = os.path.basename(filename)
    1.33 +            name = os.path.splitext(os.path.basename(filename))[0]
    1.34              pkl_file = open(".transcoded/%s.dat" % name, "rb")
    1.35              self.opts = pickle.load(pkl_file)
    1.36      # __init__()
     2.1 --- a/gmyth-stream/server/0.3/lib/request_handler.py	Wed Jul 04 08:38:36 2007 +0100
     2.2 +++ b/gmyth-stream/server/0.3/lib/request_handler.py	Wed Jul 04 09:09:48 2007 +0100
     2.3 @@ -340,9 +340,10 @@
     2.4                  self.end_headers()
     2.5  
     2.6                  try:
     2.7 -                    opts = files.TranscodedFile(filename, self.query).opts
     2.8 +                    opts = files.TranscodedFile(file_dat[0], self.query).opts
     2.9                      for key in opts.keys():
    2.10 -                        self.wfile.write("%s=%s<br>" % (key, opts.get(key, "None")))
    2.11 +                        self.wfile.write("%s=%s<br>" % (key, opts.get(key, "None")[0]))
    2.12 +
    2.13                  except Exception, e:
    2.14                      self.send_error(500, str(e))
    2.15                      return
     3.1 --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Wed Jul 04 08:38:36 2007 +0100
     3.2 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Wed Jul 04 09:09:48 2007 +0100
     3.3 @@ -60,7 +60,7 @@
     3.4              self._insert_param("-o", "file://%s" % path)
     3.5          else:
     3.6              self._insert_param ("-o", "fd://%d" % outfd.fileno())
     3.7 -            self.opts.append ("-c") 
     3.8 +            self.opts.append ("-c")
     3.9  
    3.10          cmd = " ".join(self.opts)
    3.11          self.log.info(self.tid, "GMencoder: %s" % cmd)