From 22cd65bd2f0594fbb740b1039e664a0712831163 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 8 Oct 2009 08:05:34 +0200 Subject: mpclient: fix stats() when disconnected. --- nephilim/mpclient.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nephilim/mpclient.py b/nephilim/mpclient.py index 66d1aa1..21cd511 100644 --- a/nephilim/mpclient.py +++ b/nephilim/mpclient.py @@ -48,6 +48,8 @@ class MPClient(QtCore.QObject): _db_timer_id = None #for querying db updates _db_update = None #time of last db update + __stats = {'artists': '0', 'albums' : '0', 'songs' : '0', 'uptime' : '0', + 'playtime' : '0', 'db_playtime' : '0', 'db_update' : '0'} # SIGNALS connect_changed = QtCore.pyqtSignal(bool) @@ -168,6 +170,8 @@ class MPClient(QtCore.QObject): def stats(self): """Get MPD statistics.""" + if not self.__check_command_ok('stats'): + return self.__stats return self._client.stats() def repeat(self, val): -- cgit v1.2.3