From c5917b9df4960215dfe79eaf009990bf5e562d85 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Mon, 19 Apr 2021 20:55:16 +0100 Subject: [PATCH] Bugfix: music.playing() sometimes wrongly returned False --- app/music.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/music.py b/app/music.py index c6b3850..69cdc3a 100644 --- a/app/music.py +++ b/app/music.py @@ -33,6 +33,8 @@ class Music: if not self.playing(): return None + self.fading = True + position = self.player.get_position() thread = threading.Thread(target=self._fade) @@ -60,6 +62,7 @@ class Music: p.pause() p.release() + self.fading = False def get_playtime(self): "Return elapsed play time" @@ -97,7 +100,9 @@ class Music: if self.player.get_position() > 0 and self.player.is_playing(): return True - return False + # We take a copy of the player when fading, so we could be + # playing in a fade nowFalse + return self.fading def set_position(self, ms): "Set current play time in milliseconds from start"