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"