diff --git a/cozy/control/mpris.py b/cozy/control/mpris.py index 42e0746d..b1098fef 100644 --- a/cozy/control/mpris.py +++ b/cozy/control/mpris.py @@ -392,6 +392,7 @@ def _on_app_setting_changed(self, event: str, _): def _on_current_changed(self) -> None: if not self._player.loaded_book: + print("mpris: book is not loaded") return self._metadata = self._get_new_metadata(self._player.loaded_book) diff --git a/cozy/media/gst_player.py b/cozy/media/gst_player.py index 27396c40..6fb83f53 100644 --- a/cozy/media/gst_player.py +++ b/cozy/media/gst_player.py @@ -125,26 +125,43 @@ def init(self): if self._player: self.dispose() + print('init: test1') self._player = Gst.ElementFactory.make("playbin", "player") + print('init: test2') scaletempo = Gst.ElementFactory.make("scaletempo", "scaletempo") + print('init: test3') scaletempo.sync_state_with_parent() + print('init: test4') audiobin = Gst.ElementFactory.make("bin", "audiosink") + print('init: test5') audiobin.add(scaletempo) + print('init: test6') audiosink = Gst.ElementFactory.make("autoaudiosink", "audiosink") + print('init: test7') audiobin.add(audiosink) + print('init: test8') + print('init: test9') scaletempo.link(audiosink) + print('init: test10') pad = scaletempo.get_static_pad("sink") + print('init: test11') ghost_pad = Gst.GhostPad.new("sink", pad) + print('init: test12') audiobin.add_pad(ghost_pad) + print('init: test13') self._player.set_property("audio-sink", audiobin) + print('init: test14') self._bus = self._player.get_bus() + print('init: test15') self._bus.add_signal_watch() + print('init: test16') self._bus_signal_id = self._bus.connect("message", self._on_gst_message) + print('init: test17') def dispose(self): if not self._player: @@ -159,15 +176,22 @@ def dispose(self): self.emit_event("dispose") def load_file(self, path: str): + print('load_file: test1') self.init() + print('load_file: test2') if not os.path.exists(path): raise FileNotFoundError() + print('load_file: test3') self._player.set_property("uri", "file://" + path) + print('load_file: test4') self._player.set_state(Gst.State.PAUSED) + print('load_file: test5') self._player.set_property("volume", self._volume) + print('load_file: test6') self._player.set_property("mute", False) + print('load_file: test7') def play(self): if not self._is_player_loaded() or self.state == GstPlayerState.PLAYING: diff --git a/cozy/media/player.py b/cozy/media/player.py index e018a4b0..b381687f 100644 --- a/cozy/media/player.py +++ b/cozy/media/player.py @@ -219,10 +219,12 @@ def _load_chapter(self, chapter: Chapter): return if file_changed or self._should_jump_to_chapter_position(chapter.position): + print("setting position to chapter position: " + str(chapter.position)) self._gst_player.position = chapter.position self._gst_player.playback_speed = self._book.playback_speed if file_changed or self._book.position != chapter.id: + print("setting book position to chapter id: " + str(chapter.id)) self._book.position = chapter.id self.emit_event_main_thread("chapter-changed", self._book)