summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-11-06 20:29:46 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-06 20:29:46 +0100
commitd62a3a1b1bf2eda1186aa8bf94bd33c1b54c4d59 (patch)
tree51ba23998469f46dc98781b83a355d0e6c76c1e0 /plugins
parent2a9484a6800dc4d06a7c535b6fdf58f01e1abc00 (diff)
downloadpoezio-d62a3a1b1bf2eda1186aa8bf94bd33c1b54c4d59.tar.gz
poezio-d62a3a1b1bf2eda1186aa8bf94bd33c1b54c4d59.tar.bz2
poezio-d62a3a1b1bf2eda1186aa8bf94bd33c1b54c4d59.tar.xz
poezio-d62a3a1b1bf2eda1186aa8bf94bd33c1b54c4d59.zip
mpd plugins now accepts a password and catches some errors.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mpd_client.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/mpd_client.py b/plugins/mpd_client.py
index 6298a729..5207a0d6 100644
--- a/plugins/mpd_client.py
+++ b/plugins/mpd_client.py
@@ -10,9 +10,19 @@ class Plugin(BasePlugin):
def command_mpd(self, args):
args = shell_split(args)
- c = mpd.MPDClient()
+ c = mpd.MPDClient()
+ try:
c.connect(host=self.config.get('host', 'localhost'), port=self.config.get('host', '6600'))
-
+ except Exception as e:
+ self.core.information('%s' % (e,), 'Error')
+ return
+ password = self.config.get('password', '')
+ if password:
+ try:
+ c.password(password)
+ except Exception as e:
+ self.core.information('%s' % (e,), 'Error')
+ return
current = c.currentsong()
current_time = float(c.status()['elapsed'])