Merge pull request #253 from schroeji/master
Fixed a race condition which sometimes caused an empty output.
This commit is contained in:
commit
a6e3aec2ee
@ -74,9 +74,7 @@ class Cmus(IntervalModule):
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.output = {}
|
|
||||||
response = self._query_cmus()
|
response = self._query_cmus()
|
||||||
|
|
||||||
if response:
|
if response:
|
||||||
fdict = {
|
fdict = {
|
||||||
'file': response.get('file', ''),
|
'file': response.get('file', ''),
|
||||||
@ -97,12 +95,12 @@ class Cmus(IntervalModule):
|
|||||||
filename = os.path.basename(fdict['file'])
|
filename = os.path.basename(fdict['file'])
|
||||||
filebase, _ = os.path.splitext(filename)
|
filebase, _ = os.path.splitext(filename)
|
||||||
fdict['artist'], fdict['title'] = _extract_artist_title(filebase)
|
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:
|
else:
|
||||||
self.output['full_text'] = self.format_not_running
|
self.output = {"full_text": self.format_not_running,
|
||||||
self.output['color'] = self.color_not_running
|
"color": self.color_not_running}
|
||||||
|
|
||||||
def playpause(self):
|
def playpause(self):
|
||||||
status = self._query_cmus().get('status', '')
|
status = self._query_cmus().get('status', '')
|
||||||
|
Loading…
Reference in New Issue
Block a user