Added a "track_info"-toolbar which shows an image found in the current audio file's metadata (usually the front-cover) and information about the currently playing track such as title and artist name.

This commit is contained in:
The Wobbler 2025-02-21 17:26:47 +01:00
parent ccda6b30c8
commit 39bd7e3167
5 changed files with 101 additions and 5 deletions

View file

@ -33,7 +33,7 @@ class Player:
self.playing = True
self.paused = False
self.app.gui.track_control.on_playstate_update()
self.app.gui.on_playstate_update()
# cache next track so it immediately starts when the current track finishes
self.cache_next_track()
@ -68,7 +68,7 @@ class Player:
self.app.gui.on_track_change(self.history.h_last_track(), self.current_playlist.current_track)
self.app.gui.track_control.on_playstate_update()
self.app.gui.on_playstate_update()
def play_track_in_playlist(self, track_index):
self.stop()
@ -99,7 +99,7 @@ class Player:
self.track_progress.pause()
self.paused = True
self.app.gui.track_control.on_playstate_update()
self.app.gui.on_playstate_update()
def unpause(self):
self.music_channel.unpause()
@ -108,7 +108,7 @@ class Player:
self.playing = True
self.paused = False
self.app.gui.track_control.on_playstate_update()
self.app.gui.on_playstate_update()
def next_track(self):
if not self.current_playlist.on_last_track():
@ -141,7 +141,7 @@ class Player:
self.playing = False
self.paused = False
self.app.gui.track_control.on_playstate_update()
self.app.gui.on_playstate_update()
def seek(self, position: int):
self.music_channel.stop()

View file

@ -67,6 +67,8 @@ class Track:
self.duration = len(self.audio) # track duration in milliseconds
self.tags = TinyTag.get(self.path, ignore_errors=True, duration=False, image=True) # metadata with images
self.cached = True
def clear_cache(self):
@ -76,6 +78,8 @@ class Track:
self.sound = None
self.duration = 0
self.tags = TinyTag.get(self.path, ignore_errors=True, duration=False) # metadata without images
def load_audio(self):
#file_type = self.path.split(".")[-1]