Hide MPD information when not running
This commit is contained in:
parent
73b6d96e20
commit
748ef06d8a
@ -38,7 +38,7 @@ class MPD(IntervalModule):
|
|||||||
("max_field_len", "Defines max length for in truncate_fields defined fields, if truncated, ellipsis are appended as indicator. It's applied *before* max_len. Value of 0 disables this."),
|
("max_field_len", "Defines max length for in truncate_fields defined fields, if truncated, ellipsis are appended as indicator. It's applied *before* max_len. Value of 0 disables this."),
|
||||||
("max_len", "Defines max length for the hole string, if exceeding fields specefied in truncate_fields are truncated equaly. If truncated, ellipsis are appended as indicator. It's applied *after* max_field_len. Value of 0 disables this."),
|
("max_len", "Defines max length for the hole string, if exceeding fields specefied in truncate_fields are truncated equaly. If truncated, ellipsis are appended as indicator. It's applied *after* max_field_len. Value of 0 disables this."),
|
||||||
("truncate_fields", "fields that will be truncated if exceeding max_field_len or max_len."),
|
("truncate_fields", "fields that will be truncated if exceeding max_field_len or max_len."),
|
||||||
|
("hide_inactive", "Hides information when MPD is not running"),
|
||||||
)
|
)
|
||||||
|
|
||||||
host = "localhost"
|
host = "localhost"
|
||||||
@ -54,6 +54,7 @@ class MPD(IntervalModule):
|
|||||||
max_field_len = 25
|
max_field_len = 25
|
||||||
max_len = 100
|
max_len = 100
|
||||||
truncate_fields = ("title", "album", "artist")
|
truncate_fields = ("title", "album", "artist")
|
||||||
|
hide_inactive = True
|
||||||
on_leftclick = "switch_playpause"
|
on_leftclick = "switch_playpause"
|
||||||
on_rightclick = "next_song"
|
on_rightclick = "next_song"
|
||||||
on_upscroll = on_rightclick
|
on_upscroll = on_rightclick
|
||||||
@ -78,8 +79,15 @@ class MPD(IntervalModule):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
status = self._mpd_command(self.s, "status")
|
try:
|
||||||
currentsong = self._mpd_command(self.s, "currentsong")
|
status = self._mpd_command(self.s, "status")
|
||||||
|
currentsong = self._mpd_command(self.s, "currentsong")
|
||||||
|
except Exception:
|
||||||
|
self.output = {
|
||||||
|
"full_text": ""
|
||||||
|
}
|
||||||
|
return
|
||||||
|
|
||||||
fdict = {
|
fdict = {
|
||||||
"pos": int(status.get("song", 0)) + 1,
|
"pos": int(status.get("song", 0)) + 1,
|
||||||
"len": int(status["playlistlength"]),
|
"len": int(status["playlistlength"]),
|
||||||
|
Loading…
Reference in New Issue
Block a user