Commit b721cb4aa08179bfa7d8172b62ddb8bfce133041 Parent: faa93477c02bc79d0e86bac34861df4b5c4ab0bc Author: mcol <mcol@posteo.net> Date: 2020-01-11 16:27:56 +0000 Committer: mcol <mcol@posteo.net> Committed: 2020-01-11 16:27:56 +0000 mpc: get message from new status rather than presume
qtools/mpc/mpc.py Modified
@@ -23,9 +23,16 @@ from qtools import Notifier +bodies = { + 'pause': 'Paused', + 'play': 'Playing', + 'stop': 'Stopped', +} + + def _client_func(func): @wraps(func) - def _inner(self, qtile): + def _inner(self, qtile=None): try: self.client.connect() except ConnectionError: @@ -60,10 +67,9 @@ def toggle(self): if self.client.status()['state'] == 'play': self.client.pause() - return 'Paused' else: self.client.play() - return 'Playing' + return bodies.get(self.client.status()['state']) @_client_func def next(self):