[svn r733] * GMyth-Streamer trunk
authormorphbr
Thu May 31 17:12:51 2007 +0100 (2007-05-31)
branchtrunk
changeset 72772f9152d4e2a
parent 726 6431b16e18fb
child 728 6e54ca4a4e9a
[svn r733] * GMyth-Streamer
- Bug fix for listing transcoded files
gmyth-stream/server/0.3/lib/file_handler.py
     1.1 --- a/gmyth-stream/server/0.3/lib/file_handler.py	Thu May 31 16:09:47 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/lib/file_handler.py	Thu May 31 17:12:51 2007 +0100
     1.3 @@ -6,6 +6,7 @@
     1.4  __version__ = "0.1"
     1.5  
     1.6  import os
     1.7 +import sys
     1.8  import pickle
     1.9  import lib.utils as utils
    1.10  
    1.11 @@ -23,13 +24,14 @@
    1.12              self.opts = args.copy()
    1.13  
    1.14              if self.opts["type"][0] != "myth":
    1.15 -                self.opts["original_mtime"] = os.stat(
    1.16 -                    self.opts["uri"][0])[ST_MTIME]
    1.17 +                self.opts["original_mtime"] = os.path.getmtime(
    1.18 +                    self.opts["uri"][0])
    1.19  
    1.20              name = os.path.basename(self.opts["uri"][0])
    1.21              self.opts["original"] = name
    1.22 +            output_file = os.path.basename(self.opts["outfile"][0])
    1.23              output = open(".transcoded/%s.dat" % \
    1.24 -                          os.path.basename(self.opts["outfile"][0]), "wb")
    1.25 +                          os.path.splitext(output_file)[0], "wb")
    1.26              # dumps data using the highest protocol
    1.27              pickle.dump(self.opts, output, -1)
    1.28              output.close()
    1.29 @@ -65,8 +67,11 @@
    1.30      for root, dirs, files in os.walk(directory):
    1.31          for name in files:
    1.32              if os.path.splitext(name)[1].strip(".") in ext:
    1.33 -                dat_file = os.path.join(root,name.split(".")[0]+".dat")
    1.34 -                if name not in file_list and os.path.exists(dat_file):
    1.35 +                dat_file = os.path.join(sys.path[0],root,
    1.36 +                                        os.path.splitext(name)[0]+".dat")
    1.37 +
    1.38 +                if name not in file_list and \
    1.39 +                       os.path.exists(dat_file):
    1.40                      file_list.append(name)
    1.41  
    1.42      return True