Added 'stopped' to status

And make sure that the status exist so we don't show an error to the
user.
This commit is contained in:
Thiago Kenji Okada 2016-10-19 13:34:57 -02:00
parent bdd23126d8
commit cf8415d228

View File

@ -13,7 +13,7 @@ class Spotify(IntervalModule):
.. rubric:: Available formatters .. rubric:: Available formatters
* `{status}` current status icon (paused/playing) * `{status}` current status icon (paused/playing/stopped)
* `{length}` total song duration (mm:ss format) * `{length}` total song duration (mm:ss format)
* `{artist}` artist * `{artist}` artist
* `{title}` title * `{title}` title
@ -39,6 +39,7 @@ class Spotify(IntervalModule):
status = { status = {
'paused': '', 'paused': '',
'playing': '', 'playing': '',
'stopped': '',
} }
player_name = None player_name = None
@ -69,7 +70,8 @@ class Spotify(IntervalModule):
# returns a dictionary of all player data # returns a dictionary of all player data
return { return {
"status": self.status[status.lower()] if status else None, "status": self.status[status.lower()]
if status in self.status.keys() else "",
"title": title if title else "", "title": title if title else "",
"album": album if album else "", "album": album if album else "",
"artist": artist if artist else "", "artist": artist if artist else "",