[svn r779] - Added serve_file_info method trunk
authormorphbr
Wed Jul 04 08:33:19 2007 +0100 (2007-07-04)
branchtrunk
changeset 773361cb0686ff7
parent 772 47de5c5976bf
child 774 366b0fd1eead
[svn r779] - Added serve_file_info method
gmyth-stream/server/0.3/lib/request_handler.py
     1.1 --- a/gmyth-stream/server/0.3/lib/request_handler.py	Tue Jul 03 22:45:24 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/lib/request_handler.py	Wed Jul 04 08:33:19 2007 +0100
     1.3 @@ -65,6 +65,7 @@
     1.4              "/get_all_log.do": self.serve_get_all_log,
     1.5              "/stream.do": self.serve_stream,
     1.6              "/list.do": self.serve_list,
     1.7 +            "/get_file_info.do": self.serve_file_info,
     1.8              }
     1.9  
    1.10          try:
    1.11 @@ -326,6 +327,28 @@
    1.12                      self.wfile.write("<br><br>")
    1.13      # serve_get_all_log()
    1.14  
    1.15 +
    1.16 +    def serve_file_info(self, body):
    1.17 +        if body:
    1.18 +
    1.19 +            file_dat = self.query.get("file", None)
    1.20 +
    1.21 +            if file_dat:
    1.22 +                self.send_response(200)
    1.23 +                self.send_header("Content-Type", "text/html")
    1.24 +                self.send_header('Connection', 'close')
    1.25 +                self.end_headers()
    1.26 +
    1.27 +                try:
    1.28 +                    filename = file_dat.split(".dat")[0]
    1.29 +                    opts = files.TranscodedFile(filename, self.query).opts
    1.30 +                    for key in opts.keys():
    1.31 +                        self.wfile.write("%s=%s<br>" % (key, opts.get(key, "None")))
    1.32 +                except:
    1.33 +                    self.send_error(500, str(e))
    1.34 +                    return
    1.35 +    # serve_file_info()
    1.36 +
    1.37      def serve_stream(self, body):
    1.38          transcoder = self._get_transcoder()
    1.39          try: