From f22d8015a6ede9c117a305bd941092bdf6485c7c Mon Sep 17 00:00:00 2001 From: Abdo Date: Fri, 13 May 2022 06:08:05 +0300 Subject: [PATCH] Add some helper functions to AVPlayer (#1864) --- qt/aqt/sound.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 14dfdf36d..a6bbb17f7 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -149,6 +149,14 @@ class AVPlayer: self._enqueued = tags[:] self._play_next_if_idle() + def append_tags(self, tags: list[AVTag]) -> None: + """Append provided tags to the queue, then start playing them if the current player is idle.""" + self._enqueued.extend(tags) + self._play_next_if_idle() + + def queue_is_empty(self) -> bool: + return bool(self._enqueued) + def stop_and_clear_queue(self) -> None: self._enqueued = [] self._stop_if_playing()