[modules/redshift] Minor refactoring

This commit is contained in:
Tobias Witek 2019-01-16 20:13:28 +01:00
parent 61e64044b6
commit b8d05b435f

View file

@ -37,11 +37,13 @@ def get_redshift_value(widget):
res = "" res = ""
widget.set("temp", "n/a") widget.set("temp", "n/a")
widget.set("transition", None) widget.set("transition", None)
widget.set("state", "day")
for line in res.split("\n"): for line in res.split("\n"):
if "temperature" in line.lower(): line = line.lower()
if "temperature" in line:
widget.set("temp", line.split(" ")[2]) widget.set("temp", line.split(" ")[2])
if "period" in line.lower(): if "period" in line:
state = line.split(" ")[1].lower() state = line.split(" ")[1]
if "day" in state: if "day" in state:
widget.set("state", "day") widget.set("state", "day")
elif "night" in state: elif "night" in state: