now_playing: hide_no_player option
This commit is contained in:
parent
7c6561c854
commit
146b952180
@ -35,9 +35,10 @@ class NowPlaying(IntervalModule):
|
|||||||
("status", "Dictionary mapping pause, play and stop to output text"),
|
("status", "Dictionary mapping pause, play and stop to output text"),
|
||||||
("color", "Text color"),
|
("color", "Text color"),
|
||||||
("format", "formatp string"),
|
("format", "formatp string"),
|
||||||
|
("hide_no_player", "Hide output if no player is detected"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
hide_no_player = True
|
||||||
player = None
|
player = None
|
||||||
format = "{title} {status}"
|
format = "{title} {status}"
|
||||||
status = {
|
status = {
|
||||||
@ -51,6 +52,7 @@ class NowPlaying(IntervalModule):
|
|||||||
"Stopped": "stop",
|
"Stopped": "stop",
|
||||||
}
|
}
|
||||||
color = "#FFFFFF"
|
color = "#FFFFFF"
|
||||||
|
|
||||||
old_player = None
|
old_player = None
|
||||||
|
|
||||||
def find_player(self):
|
def find_player(self):
|
||||||
@ -73,6 +75,9 @@ class NowPlaying(IntervalModule):
|
|||||||
try:
|
try:
|
||||||
player = self.get_player()
|
player = self.get_player()
|
||||||
except dbus.exceptions.DBusException:
|
except dbus.exceptions.DBusException:
|
||||||
|
if self.hide_no_player:
|
||||||
|
self.output = None
|
||||||
|
else:
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": "now_playing: d-bus error",
|
"full_text": "now_playing: d-bus error",
|
||||||
"color": "#ff0000",
|
"color": "#ff0000",
|
||||||
|
Loading…
Reference in New Issue
Block a user