blob: e5a4daf0c5d4850cd369f0ffcd55811638999611 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import logging
class Playlist:
def __init__(self, player):
self._songList = list()
self._currentSong = None
self._setSongCallback = player.setCurrentSong
def addSong(self, path):
self._songList.append(path)
logging.debug(f"Added song: {path}")
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):
index = self._currentSong
return self._songList[index] if index is not None else None
def getSongs(self):
return self._songList
|