[modules/mocp] quotes

This commit is contained in:
tobi-wan-kenobi 2020-04-19 14:33:51 +02:00
parent c0166e6763
commit b942c617c5

View file

@ -33,26 +33,26 @@ from bumblebee.output import scrollable
class Module(bumblebee.engine.Module): class Module(bumblebee.engine.Module):
def __init__(self, engine, config): def __init__(self, engine, config):
super(Module, self).__init__(engine, config, super(Module, self).__init__(engine, config,
bumblebee.output.Widget(name="mocp.main", full_text=self.description) bumblebee.output.Widget(name='mocp.main', full_text=self.description)
) )
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd="mocp -G") cmd='mocp -G')
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE,
cmd="mocp -t shuffle") cmd='mocp -t shuffle')
self._format = self.parameter("format", "%state %artist - %song | %ct/%tt") self._format = self.parameter('format', '%state %artist - %song | %ct/%tt')
self._running = 0 self._running = 0
#@scrollable #@scrollable
def description(self, widget): def description(self, widget):
return self._info if self._running == 1 else "Music On Console Player" return self._info if self._running == 1 else 'Music On Console Player'
def update(self, widgets): def update(self, widgets):
self._load_song() self._load_song()
def _load_song(self): def _load_song(self):
try: try:
self._info = bumblebee.util.execute("mocp -Q '" + self._format + "'" ).strip() self._info = bumblebee.util.execute('mocp -Q '' + self._format + """ ).strip()
self._running = 1 self._running = 1
except RuntimeError: except RuntimeError:
self._running = 0 self._running = 0