def play_index(self, index): """ Play the track with the specified playlist index """ Sound.stop() self.playlist.current = index self.play_pause()
def play_pause(self): """ Play or pause the currently playing track """ self.advance = True if Sound.state == "playing": self.pos, x = Sound.get_pos_length() Sound.stop() else: audio_file = self.get_current_file() if audio_file: Sound.play(audio_file, self.volume) if self.pos > 0: def set_pos(dt): Sound.seek(self.pos) self.pos = 0 Clock.schedule_once(set_pos, 0.1)
def stop(self): """ Stop any playing audio """ self.advance = False Sound.stop()
def play_previous(self): """ Play the previous track in the playlist. """ Sound.stop() self.playlist.move_previous() self.play_pause()
def play_next(self): """ Play the next track in the playlist. """ Sound.stop() self.playlist.move_next() self.play_pause()