# HG changeset patch
# User morphbr
# Date 1176994586 -3600
# Node ID f33b61b9d8a59c1c190e0d6ec00da1446dc7e050
# Parent 00ecee7b96255d1b36a8df17172969cb113ac216
[svn r576] * GMyth-Streamer
- Updating plugins and core to support stopping itself
diff -r 00ecee7b9625 -r f33b61b9d8a5 gmyth-stream/server/0.2/lib/server.py
--- a/gmyth-stream/server/0.2/lib/server.py Thu Apr 19 15:41:49 2007 +0100
+++ b/gmyth-stream/server/0.2/lib/server.py Thu Apr 19 15:56:26 2007 +0100
@@ -245,11 +245,14 @@
for t, r in transcoders:
if r.client_address == addr:
- t.stop()
+ try:
+ t.stop()
+ except Exception, e:
+ self.log.info("Plugin already stopped")
+
self.wfile.write("""\
%s: %s:%s
""" % (t, addr[0], addr[1]))
- t.stop()
break
self.wfile.write("""\
@@ -332,7 +335,7 @@
def serve_stream(self, body):
transcoder = self._get_transcoder()
try:
- obj = transcoder(self.query)
+ obj = transcoder(self.query, self)
except Exception, e:
self.send_error(500, str(e))
return
diff -r 00ecee7b9625 -r f33b61b9d8a5 gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py
--- a/gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py Thu Apr 19 15:41:49 2007 +0100
+++ b/gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py Thu Apr 19 15:56:26 2007 +0100
@@ -40,14 +40,14 @@
# StreamData()
- def __init__(self, params):
+ def __init__(self, params, request):
server.Transcoder.__init__(self, params)
gobject.threads_init ()
# set gstreamer basic options
self.connection = None
self.addr = None
self.ready = False
- self.quit = False
+ self.request = request
self.log.info("Params for Gstreamer: %s" % self.params)
# __init__()
@@ -257,6 +257,7 @@
self.log.info("Pipe finished")
if stream_data.Ready:
self.stop()
+ self.request.server.del_transcoders(self.request, self)
else:
stream_data.Loop.quit()
@@ -265,6 +266,7 @@
self.log.error("Error: %s %s" %(err, debug))
if stream_data.Ready:
self.stop()
+ self.request.server.del_transcoders(self.request, self)
else:
stream_data.Loop.quit()
diff -r 00ecee7b9625 -r f33b61b9d8a5 gmyth-stream/server/0.2/plugins/transcoders/mencoder.py
--- a/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py Thu Apr 19 15:41:49 2007 +0100
+++ b/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py Thu Apr 19 15:56:26 2007 +0100
@@ -113,7 +113,7 @@
# _setup_filename()
- def __init__(self, params):
+ def __init__(self, params, request):
server.Transcoder.__init__(self, params)
self.proc = None
self.args = None