# HG changeset patch
# User morphbr
# Date 1180618284 -3600
# Node ID 64b061775d066d4f69732706723573f059a4ca7a
# Parent f5f7abc760aad1262ef699031fbaa710335f0696
[svn r730] * GMyth-Streamer
- List status of more than 1 tid
- Stream without transcoding
- List files just under .transcoded and that has a .dat
diff -r f5f7abc760aa -r 64b061775d06 gmyth-stream/server/0.3/lib/file_handler.py
--- a/gmyth-stream/server/0.3/lib/file_handler.py Wed May 30 23:14:38 2007 +0100
+++ b/gmyth-stream/server/0.3/lib/file_handler.py Thu May 31 14:31:24 2007 +0100
@@ -63,9 +63,9 @@
for root, dirs, files in os.walk(directory):
for name in files:
if os.path.splitext(name)[1].strip(".") in ext:
- media = os.path.join(root,name)
- if media not in file_list:
- file_list.append(os.path.join(root,name))
+ dat_file = os.path.join(root,name.split(".")[0]+".dat")
+ if name not in file_list and os.path.exists(dat_file):
+ file_list.append(name)
return True
# list_media_files()
diff -r f5f7abc760aa -r 64b061775d06 gmyth-stream/server/0.3/lib/request_handler.py
--- a/gmyth-stream/server/0.3/lib/request_handler.py Wed May 30 23:14:38 2007 +0100
+++ b/gmyth-stream/server/0.3/lib/request_handler.py Thu May 31 14:31:24 2007 +0100
@@ -133,15 +133,13 @@
self.send_header("Content-Type", "text/html")
self.send_header('Connection', 'close')
self.end_headers()
- directories = self.query.get("directory", None)
- if body and directories:
+
+ if body:
file_list = []
- for directory in directories[0].split(";"):
- files.list_media_files(directory, file_list)
-
+ files.list_media_files(".transcoded", file_list)
output = files.FileList(map(lambda x, y: x+y, file_list,
["
"]*len(file_list)))
- self.wfile.write(utils.getHTML("file_list", {"file_list": output}))
+ self.wfile.write(output)
# serve_list()
@@ -212,18 +210,18 @@
stopone = ""
elif self.query.get("tid", None) and not tl:
- tid = int(self.query.get("tid")[0])
- stat = self.transcoders_log.get_status(tid)
- self.wfile.write("Running: %s" % stat)
+ tids = self.query.get("tid")
+ for tid in tids:
+ stat = self.transcoders_log.get_status(int(tid))
+ self.wfile.write("Running: %s
" % stat)
elif self.query.get("tid", None):
- req_tid = int(self.query.get("tid")[0])
+ req_tid = self.query.get("tid")
for transcoder, request in tl:
- if transcoder.tid == req_tid:
- self.wfile.write("Status: %s %%" % transcoder.status)
- return True
-
- return False
+ if str(transcoder.tid) in req_tid:
+ self.wfile.write("%s:Status: %s %%" % (\
+ transcoder.tid, transcoder.status))
+ return True
else:
running = "
Running transcoders:
\n" @@ -327,17 +325,23 @@ self.end_headers() if body: - test_tid = int(self.query.get("tid", "0")[0]) - if test_tid == 0 or test_tid not in self.tid_queue: - test_tid = self._get_new_id(self.server.last_tid) + if self.query.get("transcoder", None): + test_tid = int(self.query.get("tid", "0")[0]) + if test_tid == 0 or test_tid not in self.tid_queue: + test_tid = self._get_new_id(self.server.last_tid) - self.transcoders_log.insert(test_tid, "gms.%s" % obj.name) - obj.tid = test_tid - obj.log = self.transcoders_log + self.transcoders_log.insert(test_tid, "gms.%s" % obj.name) + obj.tid = test_tid + obj.log = self.transcoders_log - self.server.add_transcoders(self, obj) - obj.start(self.wfile) - self.server.del_transcoders(self, obj) + self.server.add_transcoders(self, obj) + obj.start(self.wfile) + self.server.del_transcoders(self, obj) + + elif self.query.get("type", "")[0] == "file" and \ + self.query.get("uri", None): + media = open(self.query.get("uri", None)[0]) + self.wfile.write(media.read()) # serve_stream() @@ -354,4 +358,5 @@ def log_message(self, format, *args): self.log.info("%s: %s" % (self.address_string(), format % args)) # log_message() + # RequestHandler