[svn r576] * GMyth-Streamer trunk
authormorphbr
Thu Apr 19 15:56:26 2007 +0100 (2007-04-19)
branchtrunk
changeset 571f33b61b9d8a5
parent 570 00ecee7b9625
child 572 0bc04f7e67e6
[svn r576] * GMyth-Streamer
- Updating plugins and core to support stopping itself
gmyth-stream/server/0.2/lib/server.py
gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py
gmyth-stream/server/0.2/plugins/transcoders/mencoder.py
     1.1 --- a/gmyth-stream/server/0.2/lib/server.py	Thu Apr 19 15:41:49 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.2/lib/server.py	Thu Apr 19 15:56:26 2007 +0100
     1.3 @@ -245,11 +245,14 @@
     1.4  
     1.5                  for t, r in transcoders:
     1.6                      if r.client_address == addr:
     1.7 -                        t.stop()
     1.8 +                        try:
     1.9 +                            t.stop()
    1.10 +                        except Exception, e:
    1.11 +                            self.log.info("Plugin already stopped")
    1.12 +
    1.13                          self.wfile.write("""\
    1.14           <li>%s: %s:%s</li>
    1.15  """ % (t, addr[0], addr[1]))
    1.16 -                        t.stop()
    1.17                          break
    1.18              self.wfile.write("""\
    1.19        </ul>
    1.20 @@ -332,7 +335,7 @@
    1.21      def serve_stream(self, body):
    1.22          transcoder = self._get_transcoder()
    1.23          try:
    1.24 -            obj = transcoder(self.query)
    1.25 +            obj = transcoder(self.query, self)
    1.26          except Exception, e:
    1.27              self.send_error(500, str(e))
    1.28              return
     2.1 --- a/gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py	Thu Apr 19 15:41:49 2007 +0100
     2.2 +++ b/gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py	Thu Apr 19 15:56:26 2007 +0100
     2.3 @@ -40,14 +40,14 @@
     2.4      # StreamData()
     2.5  
     2.6  
     2.7 -    def __init__(self, params):
     2.8 +    def __init__(self, params, request):
     2.9          server.Transcoder.__init__(self, params)
    2.10          gobject.threads_init ()
    2.11          # set gstreamer basic options
    2.12          self.connection = None
    2.13          self.addr = None
    2.14          self.ready = False
    2.15 -        self.quit = False
    2.16 +        self.request = request
    2.17  
    2.18          self.log.info("Params for Gstreamer: %s" % self.params)
    2.19      # __init__()
    2.20 @@ -257,6 +257,7 @@
    2.21              self.log.info("Pipe finished")
    2.22              if stream_data.Ready:
    2.23                  self.stop()
    2.24 +                self.request.server.del_transcoders(self.request, self)
    2.25              else:
    2.26                  stream_data.Loop.quit()
    2.27  
    2.28 @@ -265,6 +266,7 @@
    2.29              self.log.error("Error: %s %s" %(err, debug))
    2.30              if stream_data.Ready:
    2.31                  self.stop()
    2.32 +                self.request.server.del_transcoders(self.request, self)
    2.33              else:
    2.34                  stream_data.Loop.quit()
    2.35  
     3.1 --- a/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py	Thu Apr 19 15:41:49 2007 +0100
     3.2 +++ b/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py	Thu Apr 19 15:56:26 2007 +0100
     3.3 @@ -113,7 +113,7 @@
     3.4      # _setup_filename()
     3.5  
     3.6  
     3.7 -    def __init__(self, params):
     3.8 +    def __init__(self, params, request):
     3.9          server.Transcoder.__init__(self, params)
    3.10          self.proc = None
    3.11          self.args = None