Added DEBUG statements to investigate issue #11

This commit is contained in:
Keith Edmunds 2021-06-11 09:05:02 +01:00
parent 6e754c1b3a
commit 8baf01bc60
2 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -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