1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!./bin/python3
- from handler import BaseHandler
- from handler.lib.pymplb import MPlayer
- class StreamHandler(BaseHandler):
- def __init__(self, config, display):
- super().__init__(config, display)
- self._mplayer = None
- def update(self):
- '''
- Called when the handler should update the display.
- '''
- self.display.update(title=[
- "",
- "Stream:",
- self.item["name"]
- ], img=self.item.get("img"))
- if self._mplayer is None:
- self._mplayer = MPlayer()
- self._mplayer.loadfile(self.item["url"])
- def stop(self):
- '''
- Called when the handler should stop.
- '''
- if self._mplayer is not None:
- self._mplayer.quit()
- self._mplayer = None
- def emitEvent(self, event):
- '''
- Called when an event has happened.
- '''
- super().emitEvent(event)
|