diff options
Diffstat (limited to 'plugins/mpd_client.py')
-rw-r--r-- | plugins/mpd_client.py | 14 |
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']) |