# HG changeset patch # User renatofilho # Date 1187181192 -3600 # Node ID b1d0964060b36f2a796676cb446357396c95dc83 # Parent d0e8c542c38e953e797ef7de49cd8603fed09b27 [svn r809] fixed bugs on transcode diff -r d0e8c542c38e -r b1d0964060b3 gmyth-stream/server/0.3/lib/request_handler.py --- a/gmyth-stream/server/0.3/lib/request_handler.py Mon Aug 13 23:03:08 2007 +0100 +++ b/gmyth-stream/server/0.3/lib/request_handler.py Wed Aug 15 13:33:12 2007 +0100 @@ -362,7 +362,8 @@ return #Only stream files on .transcode dir - filename = ".transcode/" + os.path.basename(filename) + filename = ".transcoded/" + os.path.basename(filename) + self.log.error("Stream file: %s" % filename) if not os.path.exists (filename): self.send_error(404, "File not found") return @@ -386,13 +387,16 @@ self.transcoders_log.insert(test_tid, "gms.Stream: %s" % filename) try: + file_data = "" while data_in != "": data_in = media.read(4096) - total_read += 4096 - self.wfile.write(data_in) - status = utils.progress_bar(total_read, size, 50) - msg_status = "Status:%s:%s%%" % (test_tid, status) - self.transcoders_log._update_status(test_tid, msg_status) + file_data += data_in + + #total_read += 4096 + self.wfile.write(file_data) + #status = utils.progress_bar(total_read, size, 50) + #msg_status = "Status:%s:%s%%" % (test_tid, status) + #self.transcoders_log._update_status(test_tid, msg_status) self.transcoders_log._update_status(test_tid, "OK: Done") @@ -435,7 +439,11 @@ obj.log = self.transcoders_log self.server.add_transcoders(self, obj) - obj.start(self.wfile) + if obj.start(self.wfile): + self.transcoders_log.info (test_tid, "OK") + else: + self.transcoders_log.info (test_tid, "Fail") + self.server.del_transcoders(self, obj) files.TranscodedFile("", self.query) diff -r d0e8c542c38e -r b1d0964060b3 gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Mon Aug 13 23:03:08 2007 +0100 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Wed Aug 15 13:33:12 2007 +0100 @@ -34,17 +34,6 @@ self.opts.append ("-d") self._parser_params () - outfile = self.params_first("outfile", "") - - if outfile != "": - path = os.path.join(sys.path[0], ".transcoded", outfile) - self._insert_param("-o", "file://%s" % path) - else: - self._insert_param ("-o", "fd://%d" % outfd.fileno()) - self.opts.append ("-c") - - cmd = " ".join(self.opts) - # __init__() def _insert_param (self, name, value): @@ -66,6 +55,16 @@ # _parse_params def start(self, outfd): + outfile = self.params_first("outfile", "") + + if outfile != "": + path = os.path.join(sys.path[0], ".transcoded", outfile) + self._insert_param("-o", "file://%s" % path) + else: + self._insert_param ("-o", "fd://%d" % outfd.fileno()) + self.opts.append ("-c") + + cmd = " ".join(self.opts) self.log.info(self.tid, "GMencoder: %s" % cmd) try: @@ -88,6 +87,10 @@ return False self.status = 100; + + if outfile: + outfd.write("OK ") + return True # start()