forked from Wobbl/Wobuzz
Added a "Playlist" class.
This commit is contained in:
parent
1190059218
commit
94269fdae4
7 changed files with 119 additions and 53 deletions
|
@ -37,24 +37,24 @@ class TrackControl:
|
|||
self.track_control.track_progress_slider.sliderReleased.connect(self.on_slider_release)
|
||||
|
||||
def previous_track(self):
|
||||
if len(self.app.player.current_playlist) > 0:
|
||||
if self.app.player.current_playlist.has_tracks():
|
||||
self.app.player.previous_track()
|
||||
|
||||
def stop(self):
|
||||
if len(self.app.player.current_playlist) > 0:
|
||||
if self.app.player.current_playlist.has_tracks():
|
||||
self.app.player.stop()
|
||||
|
||||
def next_track(self):
|
||||
if len(self.app.player.current_playlist) > 0:
|
||||
if self.app.player.current_playlist.has_tracks():
|
||||
self.app.player.next_track()
|
||||
|
||||
def on_slider_release(self):
|
||||
if len(self.app.player.current_playlist) > 0:
|
||||
if self.app.player.current_playlist.has_tracks():
|
||||
self.app.player.seek(self.track_control.track_progress_slider.value())
|
||||
|
||||
def on_track_start(self):
|
||||
if self.app.player.playing:
|
||||
duration = self.app.player.current_track.duration
|
||||
duration = self.app.player.current_playlist.current_track.duration
|
||||
|
||||
self.track_control.track_progress_slider.setRange(
|
||||
0,
|
||||
|
@ -73,7 +73,7 @@ class TrackControl:
|
|||
if remaining == -1:
|
||||
remaining = self.app.player.track_progress.remaining_time
|
||||
|
||||
track_duration = self.app.player.current_track.duration
|
||||
track_duration = self.app.player.current_playlist.current_track.duration
|
||||
|
||||
progress = track_duration - remaining
|
||||
|
||||
|
@ -95,7 +95,7 @@ class TrackControl:
|
|||
self.app.player.pause()
|
||||
self.track_control.toggle_play_button.setIcon(self.play_icon)
|
||||
|
||||
elif len(self.app.player.current_playlist) > 0: # stopped but tracks in the current playlist
|
||||
elif self.app.player.current_playlist.has_tracks(): # stopped but tracks in the current playlist
|
||||
self.app.player.start_playing()
|
||||
self.track_control.toggle_play_button.setIcon(self.pause_icon)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue