summaryrefslogtreecommitdiff
path: root/nephilim/mpclient.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-08-24 20:46:27 +0200
committerAnton Khirnov <wyskas@gmail.com>2009-08-24 20:46:27 +0200
commite4f46487145be0bbcd2aa278388a1b4b3ef78f54 (patch)
tree4e0170664bdc651c782601544572170d20090239 /nephilim/mpclient.py
parente7c01e7b53f02b24e6938d945e84453537f3fa31 (diff)
song: convert to a subclass of dict.
also don't store whole song in Library and Playlist, this saves a significant amount of memory.
Diffstat (limited to 'nephilim/mpclient.py')
-rw-r--r--nephilim/mpclient.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/nephilim/mpclient.py b/nephilim/mpclient.py
index 35be3f5..bd137ea 100644
--- a/nephilim/mpclient.py
+++ b/nephilim/mpclient.py
@@ -21,7 +21,7 @@ import mpd
import socket
import logging
-from song import Song
+from song import Song, SongRef, PlaylistEntryRef
class MPClient(QtCore.QObject):
"""This class offers another layer above pympd, with usefull events."""
@@ -45,7 +45,7 @@ class MPClient(QtCore.QObject):
# SIGNALS
connect_changed = QtCore.pyqtSignal(bool)
db_updated = QtCore.pyqtSignal()
- song_changed = QtCore.pyqtSignal(str)
+ song_changed = QtCore.pyqtSignal(object)
time_changed = QtCore.pyqtSignal(int)
state_changed = QtCore.pyqtSignal(str)
volume_changed = QtCore.pyqtSignal(int)
@@ -87,7 +87,7 @@ class MPClient(QtCore.QObject):
self.logger.error('Don\'t have MPD read permission, diconnecting.')
return self.disconnect_mpd()
- self._update_current_song()
+ self.__update_current_song()
self._db_update = self.stats()['db_update']
self.emit(QtCore.SIGNAL('connected')) #should be removed
@@ -139,7 +139,7 @@ class MPClient(QtCore.QObject):
def status(self):
"""Get current MPD status."""
return self._status
- def playlist(self):
+ def playlistinfo(self):
"""Returns a list of songs in current playlist."""
self.logger.info('Listing current playlist.')
if not self.__check_command_ok('playlistinfo'):
@@ -368,7 +368,7 @@ class MPClient(QtCore.QObject):
return map(lambda entry: Song(entry)
, filter(lambda entry: not('directory' in entry), array)
)
- def _update_current_song(self):
+ def __update_current_song(self):
"""Update the current song."""
song = self._retrieve(self._client.currentsong)
if not song:
@@ -424,10 +424,10 @@ class MPClient(QtCore.QObject):
if not self._status:
return self.disconnect_mpd()
- self._update_current_song()
+ self.__update_current_song()
if self._status['songid'] != old_status['songid']:
- self.song_changed.emit(self._status['songid'])
+ self.song_changed.emit(PlaylistEntryRef(self, self._status['songid']))
if self._status['time'] != old_status['time']:
self.time_changed.emit(self._status['time'])