ratp: Ensure InfoChannelRef is present
This commit is contained in:
parent
b21112be3f
commit
42ced57be1
@ -193,14 +193,14 @@ class RATPWeatherModule:
|
|||||||
return icon
|
return icon
|
||||||
|
|
||||||
for info in weather[mode][line]:
|
for info in weather[mode][line]:
|
||||||
if info["InfoChannelRef"]["value"] != "Perturbation":
|
if "InfoChannelRef" not in info or info["InfoChannelRef"]["value"] != "Perturbation":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if "Message" not in info["Content"]:
|
if "Message" not in info["Content"]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for msg in info["Content"]["Message"]:
|
for msg in info["Content"]["Message"]:
|
||||||
if msg["MessageType"] != "SHORT_MESSAGE":
|
if "MessageType" not in msg or msg["MessageType"] != "SHORT_MESSAGE":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
yield {
|
yield {
|
||||||
@ -233,6 +233,7 @@ class RATPWeatherModule:
|
|||||||
|
|
||||||
states = []
|
states = []
|
||||||
for info in weather[mode][line]:
|
for info in weather[mode][line]:
|
||||||
|
if "InfoChannelRef" in info:
|
||||||
states.append(info["InfoChannelRef"]["value"])
|
states.append(info["InfoChannelRef"]["value"])
|
||||||
|
|
||||||
fill = "gray" if "Perturbation" not in states else "black"
|
fill = "gray" if "Perturbation" not in states else "black"
|
||||||
|
Loading…
Reference in New Issue
Block a user