Added indicator icon that shows on the currently playing track.

This commit is contained in:
The Wobbler 2024-12-29 18:55:55 +01:00
parent 29cc80feae
commit efcae74382
5 changed files with 41 additions and 10 deletions

View file

@ -37,11 +37,12 @@ class Player:
def track_finished(self):
if not self.current_playlist.on_last_track():
previous_track = self.current_playlist.current_track
self.current_sound, self.current_sound_duration = self.current_playlist.next_track()
self.play()
self.track_progress.start()
self.app.gui_communication.on_track_start()
self.app.gui_communication.on_track_change(previous_track, self.current_playlist.current_track)
else:
self.stop()
@ -52,17 +53,21 @@ class Player:
self.play()
self.track_progress.start()
self.app.gui_communication.on_track_start()
self.app.gui_communication.on_track_change(None, self.current_playlist.current_track)
self.app.gui_communication.on_playstate_update()
def play_track_in_playlist(self, track_index):
self.stop()
previous_track = self.current_playlist.current_track
self.current_sound, self.current_sound_duration = self.current_playlist.set_track(track_index)
self.play()
self.track_progress.start()
self.app.gui_communication.on_track_start()
self.app.gui_communication.on_track_change(previous_track, self.current_playlist.current_track)
def pause(self):
self.music_channel.pause()
@ -90,6 +95,8 @@ class Player:
if not self.current_playlist.on_first_track():
self.music_channel.stop()
last_track = self.current_playlist.current_track
self.current_sound, self.current_sound_duration = self.current_playlist.previous_track()
self.track_progress.stop()
@ -97,7 +104,7 @@ class Player:
self.play()
self.track_progress.start()
self.app.gui_communication.on_track_start()
self.app.gui_communication.on_track_change(last_track, self.current_playlist.current_track)
def stop(self):
self.music_channel.stop()