From 19563930c542c06b63d223522e4c34d9c98f1577 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Sun, 22 Dec 2024 17:20:18 +0100 Subject: [PATCH] Fixed some progress bar bugs again. --- wobuzz/gui.py | 2 +- wobuzz/player/player.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/wobuzz/gui.py b/wobuzz/gui.py index 6bf7485..1490efc 100644 --- a/wobuzz/gui.py +++ b/wobuzz/gui.py @@ -18,5 +18,5 @@ class GUI: self.window.main_container.track_control.previous_button.triggered.connect(self.app.player.previous_track) self.window.main_container.track_control.toggle_play_button.triggered.connect(self.app.player.toggle_playing) self.window.main_container.track_control.stop_button.triggered.connect(self.app.player.stop) - self.window.main_container.track_control.next_button.triggered.connect(self.app.player.skip_current) + self.window.main_container.track_control.next_button.triggered.connect(self.app.player.next_track) diff --git a/wobuzz/player/player.py b/wobuzz/player/player.py index e0dd747..5e632e1 100644 --- a/wobuzz/player/player.py +++ b/wobuzz/player/player.py @@ -57,6 +57,8 @@ class Player: self.music_channel.play(self.playing_track.sound) self.track_progress.start() self.app.gui_communication.on_track_start() + self.playing = True + self.paused = False else: self.current_playlist_index -= 1 @@ -78,9 +80,10 @@ class Player: self.music_channel.unpause() self.track_progress.unpause() self.paused = False + self.playing = True - def skip_current(self): - if self.has_tracks: + def next_track(self): + if self.has_tracks and self.current_playlist_index < len(self.current_playlist) - 1: self.music_channel.stop() self.track_progress.stop() self.track_finished() @@ -100,6 +103,9 @@ class Player: self.track_progress.start() self.app.gui_communication.on_track_start() + self.playing = True + self.paused = False + def toggle_playing(self): if self.playing and self.paused: self.unpause() @@ -114,9 +120,11 @@ class Player: if self.has_tracks: self.music_channel.stop() self.track_progress.stop() - self.playing = False self.playing_segment_duration = self.playing_track.duration + self.playing = False + self.paused = False + def seek(self, position: int): if self.has_tracks: self.searched = True @@ -126,3 +134,5 @@ class Player: self.music_channel.play(self.playing_segment) self.track_progress.start() + self.playing = True +