aboutsummaryrefslogtreecommitdiffstats
path: root/playlist.py
diff options
context:
space:
mode:
Diffstat (limited to 'playlist.py')
-rw-r--r--playlist.py26
1 files changed, 7 insertions, 19 deletions
diff --git a/playlist.py b/playlist.py
index b175a08..6e96534 100644
--- a/playlist.py
+++ b/playlist.py
@@ -1,24 +1,10 @@
import logging
-"""
-class PlaylistModel(QAbstractListModel):
- def __init__(self, medialist, *args, **kwargs):
- super(PlaylistModel, self).__init__(*args, **kwargs)
- self.medialist = medialist
-
- def data(self, index, role):
- if role == Qt.DisplayRole:
- return self.medialist.item_at_index(index.row()).get_mrl()
-
- def rowCount(self, index):
- return self.medialist.count()
-"""
-
class Playlist:
- def __init__(self, setSongCallback):
+ def __init__(self, callback):
self.songList = list()
self.currentSong = None
- self.callback = setSongCallback
+ self.setSongCallback = callback
def addSong(self, path):
self.songList.append(path)
@@ -27,8 +13,10 @@ class Playlist:
self.setCurrentSong(0)
def setCurrentSong(self, index):
- if index < len(self.songList):
+ if index >= 0 and index < len(self.songList):
self.currentSong = index
- self.callback(self.songList[index])
+ self.setSongCallback(self.songList[index])
logging.debug(f"Selected song: {self.currentSong}")
-
+
+ def getCurrentSong(self):
+ return self.currentSong