123456789101112131415161718192021222324252627282930313233343536 |
- #!./bin/python3
- from display import Display
- from typing import Dict
- from pymplb import MPlayer
- class Player(Display):
- '''
- Player object
- '''
- def __init__(self, config, pydsp):
- super().__init__({
- "dimx" : config.get("dimx"),
- "dimx" : config.get("dimy"),
- "playlist" : config.get("dimy"),
- "fontsize" : config.get("fontsize"),
- }, pydsp)
- self._player = MPlayer()
- def setData(self, data: Dict):
- self._data = data
- def loadPlaylist(self) -> Dict:
- return self._data
-
- def togglePlay(self):
- if not self._current_item:
- return
-
- if self._player.p_path == self._current_item["path"]:
- print("stop")
- self._player.stop()
- else:
- print("Playing:", self._current_item)
- self._player.loadfile(self._current_item["path"])
|