Merge pull request #253 from schroeji/master

Fixed a race condition which sometimes caused an empty output.
This commit is contained in:
enkore 2015-09-23 12:54:23 +02:00
commit a6e3aec2ee

View File

@ -74,9 +74,7 @@ class Cmus(IntervalModule):
return response
def run(self):
self.output = {}
response = self._query_cmus()
if response:
fdict = {
'file': response.get('file', ''),
@ -97,12 +95,12 @@ class Cmus(IntervalModule):
filename = os.path.basename(fdict['file'])
filebase, _ = os.path.splitext(filename)
fdict['artist'], fdict['title'] = _extract_artist_title(filebase)
self.output = {"full_text": formatp(self.format, **fdict),
"color": self.color}
self.output['full_text'] = formatp(self.format, **fdict)
self.output['color'] = self.color
else:
self.output['full_text'] = self.format_not_running
self.output['color'] = self.color_not_running
self.output = {"full_text": self.format_not_running,
"color": self.color_not_running}
def playpause(self):
status = self._query_cmus().get('status', '')