def switch_track_sync(self, from_grid=True):
if not self.playlist:
return
if self.current_track_i >= 0:
if self.player.get_state() in {vlc.State.Playing, vlc.State.Paused}:
self.playlist[self.current_track_i]['color'] = Colors.BG_SKIPPED
if self.fade_in_out and self.player.get_state() == vlc.State.Playing:
self.fade_out_sync(self.stop_fade_speed) # Blocks thread
else:
self.playlist[self.current_track_i]['color'] = Colors.BG_PLAYED_TO_END
if self.window_exists():
self.window.grid.SetCellBackgroundColour(self.current_track_i, 0,
self.playlist[self.current_track_i]['color'])
self.window.grid.ForceRefresh() # Updates colors
if self.window_exists() and from_grid:
self.current_track_i = self.window.grid.GetSelectedRows()[0]
else:
self.current_track_i = (self.current_track_i + 1) % len(self.playlist)
self.parent.bg_player.play_sync()
self.parent.bg_pause_switch.Enable(True)
评论列表
文章目录