From 8baf01bc601f3fc697095e6878559ef178dea80e Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Fri, 11 Jun 2021 09:05:02 +0100 Subject: [PATCH] Added DEBUG statements to investigate issue #11 --- app/music.py | 8 +++++--- app/musicmuster.py | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/music.py b/app/music.py index b8ba2b7..63fc13e 100644 --- a/app/music.py +++ b/app/music.py @@ -115,6 +115,8 @@ class Music: Log and return if path not found. """ + DEBUG(f"music.play({path=})", True) + if not os.access(path, os.R_OK): ERROR(f"play({path}): path not found") return @@ -163,15 +165,15 @@ class Music: def stop(self): "Immediately stop playing" - with lock: - DEBUG(f"music.stop(), {self.player=}", True) + DEBUG(f"music.stop(), {self.player=}", True) + with lock: if not self.player: return position = self.player.get_position() self.player.stop() - DEBUG(f"Releasing player {self.player=}", True) + DEBUG(f"music.stop(): Releasing player {self.player=}", True) self.player.release() # Ensure we don't reference player after release self.player = None diff --git a/app/musicmuster.py b/app/musicmuster.py index 20e5959..ad13437 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -354,17 +354,19 @@ class Window(QMainWindow, Ui_MainWindow): Update metadata and headers, and repaint """ - # If there is no next track set, return. - if not self.next_track: - return - DEBUG( - "play_next(), " + "musicmuster.play_next(), " f"next_track={self.next_track.title if self.next_track else None} " "current_track=" - f"{self.current_track.title if self.current_track else None}" + f"{self.current_track.title if self.current_track else None}", + True ) + # If there is no next track set, return. + if not self.next_track: + DEBUG("musicmuster.play_next(): no next track selected", True) + return + with Session() as session: # Stop current track, if any self.stop_playing() @@ -374,6 +376,10 @@ class Window(QMainWindow, Ui_MainWindow): self.current_track_playlist_tab = self.next_track_playlist_tab self.next_track = None self.next_track_playlist_tab = None + DEBUG( + "musicmuster.play_next: calling music.play(" + f"{self.current_track.path=})" + ) self.music.play(self.current_track.path) # Update metadata