import logging class Playlist: def __init__(self, callback): self.songList = list() self.currentSong = None self.setSongCallback = callback def addSong(self, path): self.songList.append(path) logging.debug(f"Added song: {path}") if self.currentSong is None: self.setCurrentSong(0) def setCurrentSong(self, index): if index >= 0 and index < len(self.songList): self.currentSong = index self.setSongCallback(self.songList[index]) logging.debug(f"Selected song: {self.currentSong}") def getCurrentSong(self): return self.currentSong