[svn r730] * GMyth-Streamer trunk
authormorphbr
Thu May 31 14:31:24 2007 +0100 (2007-05-31)
branchtrunk
changeset 72464b061775d06
parent 723 f5f7abc760aa
child 725 a102805611e7
[svn r730] * GMyth-Streamer
- List status of more than 1 tid
- Stream without transcoding
- List files just under .transcoded and that has a .dat
gmyth-stream/server/0.3/lib/file_handler.py
gmyth-stream/server/0.3/lib/request_handler.py
     1.1 --- a/gmyth-stream/server/0.3/lib/file_handler.py	Wed May 30 23:14:38 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/lib/file_handler.py	Thu May 31 14:31:24 2007 +0100
     1.3 @@ -63,9 +63,9 @@
     1.4      for root, dirs, files in os.walk(directory):
     1.5          for name in files:
     1.6              if os.path.splitext(name)[1].strip(".") in ext:
     1.7 -                media = os.path.join(root,name)
     1.8 -                if media not in file_list:
     1.9 -                    file_list.append(os.path.join(root,name))
    1.10 +                dat_file = os.path.join(root,name.split(".")[0]+".dat")
    1.11 +                if name not in file_list and os.path.exists(dat_file):
    1.12 +                    file_list.append(name)
    1.13  
    1.14      return True
    1.15  # list_media_files()
     2.1 --- a/gmyth-stream/server/0.3/lib/request_handler.py	Wed May 30 23:14:38 2007 +0100
     2.2 +++ b/gmyth-stream/server/0.3/lib/request_handler.py	Thu May 31 14:31:24 2007 +0100
     2.3 @@ -133,15 +133,13 @@
     2.4          self.send_header("Content-Type", "text/html")
     2.5          self.send_header('Connection', 'close')
     2.6          self.end_headers()
     2.7 -        directories = self.query.get("directory", None)
     2.8 -        if body and directories:
     2.9 +
    2.10 +        if body:
    2.11              file_list = []
    2.12 -            for directory in directories[0].split(";"):
    2.13 -                files.list_media_files(directory, file_list)
    2.14 -
    2.15 +            files.list_media_files(".transcoded", file_list)
    2.16              output = files.FileList(map(lambda x, y: x+y, file_list,
    2.17                                          ["<br>"]*len(file_list)))
    2.18 -            self.wfile.write(utils.getHTML("file_list", {"file_list": output}))
    2.19 +            self.wfile.write(output)
    2.20  
    2.21      # serve_list()
    2.22  
    2.23 @@ -212,18 +210,18 @@
    2.24                  stopone = ""
    2.25  
    2.26              elif self.query.get("tid", None) and not tl:
    2.27 -                tid = int(self.query.get("tid")[0])
    2.28 -                stat = self.transcoders_log.get_status(tid)
    2.29 -                self.wfile.write("Running: %s" % stat)
    2.30 +                tids = self.query.get("tid")
    2.31 +                for tid in tids:
    2.32 +                    stat = self.transcoders_log.get_status(int(tid))
    2.33 +                    self.wfile.write("Running: %s<br>" % stat)
    2.34  
    2.35              elif self.query.get("tid", None):
    2.36 -                req_tid = int(self.query.get("tid")[0])
    2.37 +                req_tid = self.query.get("tid")
    2.38                  for transcoder, request in tl:
    2.39 -                    if transcoder.tid == req_tid:
    2.40 -                        self.wfile.write("Status: %s %%" % transcoder.status)
    2.41 -                        return True
    2.42 -
    2.43 -                return False
    2.44 +                    if str(transcoder.tid) in req_tid:
    2.45 +                        self.wfile.write("%s:Status: %s %%" % (\
    2.46 +                            transcoder.tid, transcoder.status))
    2.47 +                return True
    2.48  
    2.49              else:
    2.50                  running = "<p>Running transcoders:</p>\n"
    2.51 @@ -327,17 +325,23 @@
    2.52          self.end_headers()
    2.53  
    2.54          if body:
    2.55 -            test_tid = int(self.query.get("tid", "0")[0])
    2.56 -            if test_tid == 0 or test_tid not in self.tid_queue:
    2.57 -                test_tid = self._get_new_id(self.server.last_tid)
    2.58 +            if self.query.get("transcoder", None):
    2.59 +                test_tid = int(self.query.get("tid", "0")[0])
    2.60 +                if test_tid == 0 or test_tid not in self.tid_queue:
    2.61 +                    test_tid = self._get_new_id(self.server.last_tid)
    2.62  
    2.63 -            self.transcoders_log.insert(test_tid, "gms.%s" % obj.name)
    2.64 -            obj.tid = test_tid
    2.65 -            obj.log = self.transcoders_log
    2.66 +                self.transcoders_log.insert(test_tid, "gms.%s" % obj.name)
    2.67 +                obj.tid = test_tid
    2.68 +                obj.log = self.transcoders_log
    2.69  
    2.70 -            self.server.add_transcoders(self, obj)
    2.71 -            obj.start(self.wfile)
    2.72 -            self.server.del_transcoders(self, obj)
    2.73 +                self.server.add_transcoders(self, obj)
    2.74 +                obj.start(self.wfile)
    2.75 +                self.server.del_transcoders(self, obj)
    2.76 +
    2.77 +            elif self.query.get("type", "")[0] == "file" and \
    2.78 +                     self.query.get("uri", None):
    2.79 +                media = open(self.query.get("uri", None)[0])
    2.80 +                self.wfile.write(media.read())
    2.81      # serve_stream()
    2.82  
    2.83  
    2.84 @@ -354,4 +358,5 @@
    2.85      def log_message(self, format, *args):
    2.86          self.log.info("%s: %s" % (self.address_string(), format % args))
    2.87      # log_message()
    2.88 +
    2.89  # RequestHandler