Fixed a race condition which sometimes caused an empty output.
This commit is contained in:
parent
73b6d96e20
commit
8a3b8c2112
@ -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', '')
|
||||
|
Loading…
Reference in New Issue
Block a user