Fixed "crash" when the last track of the playlist finished.
This commit is contained in:
parent
bd69ddbcde
commit
a97fe2e0cf
1 changed files with 12 additions and 6 deletions
|
@ -56,13 +56,18 @@ class Player:
|
|||
|
||||
def track_finished(self):
|
||||
self.current_playlist_index += 1
|
||||
self.playing_track = self.current_playlist[self.current_playlist_index]
|
||||
self.playing_segment = self.playing_track.sound
|
||||
self.playing_segment_duration = self.playing_track.duration
|
||||
if self.current_playlist_index < len(self.current_playlist):
|
||||
self.playing_track = self.current_playlist[self.current_playlist_index]
|
||||
self.playing_segment = self.playing_track.sound
|
||||
self.playing_segment_duration = self.playing_track.duration
|
||||
|
||||
self.music_channel.play(self.playing_track.sound)
|
||||
self.track_progress.start()
|
||||
self.app.gui_communication.on_track_start()
|
||||
self.music_channel.play(self.playing_track.sound)
|
||||
self.track_progress.start()
|
||||
self.app.gui_communication.on_track_start()
|
||||
|
||||
else:
|
||||
self.current_playlist_index -= 1
|
||||
self.stop()
|
||||
|
||||
def start_playing(self):
|
||||
self.music_channel.play(self.playing_track.sound)
|
||||
|
@ -114,6 +119,7 @@ class Player:
|
|||
self.music_channel.stop()
|
||||
self.track_progress.stop()
|
||||
self.playing = False
|
||||
self.playing_segment_duration = self.playing_track.duration
|
||||
|
||||
def seek(self, position: int):
|
||||
self.searched = True
|
||||
|
|
Loading…
Add table
Reference in a new issue