diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2021-12-21 18:24:55 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2021-12-21 18:24:55 +0100 |
commit | 6eb42e6d4468ad161281125c77a41063f93380e1 (patch) | |
tree | 35ad2edeb7058ad60f47affb1b27dfac3fa62bac /playlist.py | |
parent | c1bfcc6064b3a22c76b986d9339daf6cbd403c80 (diff) |
Added session manager, renamed solo-tool.py
Diffstat (limited to 'playlist.py')
-rw-r--r-- | playlist.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/playlist.py b/playlist.py index 6e96534..5c52774 100644 --- a/playlist.py +++ b/playlist.py @@ -2,21 +2,23 @@ import logging class Playlist: def __init__(self, callback): - self.songList = list() - self.currentSong = None - self.setSongCallback = callback + self._songList = list() + self._currentSong = None + self._setSongCallback = callback def addSong(self, path): - self.songList.append(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}") + 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 + index = self._currentSong + return self._songList[index] if index is not None else None + + def getSongs(self): + return self._songList |