summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-04-25 07:59:00 +0200
committerAnton Khirnov <anton@khirnov.net>2013-04-25 07:59:00 +0200
commit8901b6955f1c74436c2033b4a8ac43f01a067682 (patch)
tree84e45fc8bceb40a519b7a120c39d4761795e892a
parentb9789e36eb79307ddc0567d63b36c2419a414461 (diff)
song: drop PlaylistEntryRef
It adds a lot of complexity for little real benefit.
-rw-r--r--nephilim/plugins/Playlist.py3
-rw-r--r--nephilim/song.py22
2 files changed, 2 insertions, 23 deletions
diff --git a/nephilim/plugins/Playlist.py b/nephilim/plugins/Playlist.py
index 05a8596..d7a2f4e 100644
--- a/nephilim/plugins/Playlist.py
+++ b/nephilim/plugins/Playlist.py
@@ -19,7 +19,6 @@ from PyQt4 import QtGui, QtCore
from ..plugin import Plugin
from ..common import MIMETYPES, SongsMimeData
-from ..song import PlaylistEntryRef
class Playlist(Plugin):
# public, const
@@ -145,7 +144,7 @@ class PlaylistTree(QtGui.QTreeWidget):
self._cur_song = None
self.clear()
for song in songs:
- item = PlaylistSongItem(PlaylistEntryRef(self.plugin.mpclient, song['id']))
+ item = PlaylistSongItem(song)
for i in range(len(columns)):
item.setText(i, song['?' + columns[i]])
self.addTopLevelItem(item)
diff --git a/nephilim/song.py b/nephilim/song.py
index eb5fedb..709934a 100644
--- a/nephilim/song.py
+++ b/nephilim/song.py
@@ -26,7 +26,7 @@ class Song(dict):
Song provides a dictionary-like wrapper around song metadata.
Its instances are generated by MPClient, don't instantiate it
directly.
- Its instances _shouldn't_ be stored, use SongRef or PlaylistEntryRef for that.
+ Its instances _shouldn't_ be stored, use SongRef for that.
Access '?tag' to get always at least an empty string.
"""
@@ -109,23 +109,3 @@ class SongRef:
def song(self):
return list(self.mpclient.find_sync('file', self.path))[0]
-
-class PlaylistEntryRef:
- """This class stores a reference to a playlist entry instead of full
- metadata to conserve memory. Song's tags can be accessed
- as in Song, but it requires a call to MPD for each tag. """
- plid = None
- mpclient = None
-
- def __init__(self, mpclient, plid):
- self.mpclient = mpclient
- self.plid = plid
-
- def __getitem__(self, key):
- return self.plid if key == 'id' else self.song()[key]
-
- def __nonzero__(self):
- return self.plid != '-1'
-
- def song(self):
- return self.mpclient.get_plist_song(self.plid)