ratp: Include tramways in alerts

This commit is contained in:
nemunaire 2023-01-19 12:57:25 +01:00
parent c84449f034
commit 615f2a8652
2 changed files with 4 additions and 3 deletions

View File

@ -101,7 +101,7 @@ def main(only_on_coming_evt=False, ignore_module=[], force_coming_event=True, ex
shape.append(WidgetPlacement(WeeklyWeatherModule, size=(int(480/1.6), 275), position=(480-int(480/1.6), NEXT_STOP_Y + occuped_space + (5 if occuped_space else 0))))
# RATP weather
major_lines = ["M7", "M14", "RB", "T3A"]
major_lines = ["M7", "M14", "RB", "TT3A"]
weekday = datetime.now().weekday()
if weekday == 0 or weekday == 1 or weekday == 3:
major_lines.append("M1")

View File

@ -77,7 +77,7 @@ class IDFMAPI:
"MessageType": "SHORT_MESSAGE",
"MessageText": {
"id": src["id"],
"title": src["title"].replace("Métro " + line + " : ", '').replace("Ligne " + line + " : ", ''),
"title": src["title"].replace("Métro " + line + " : ", '').replace("Ligne " + line + " : ", '').replace("Tramway " + line + " : ", ''),
"value": re.sub(cleanr, '', re.sub(cleanrA, '', src["message"].replace('&nbsp;', ' ').replace('&#8217;', "'").replace('&#224;', 'à').replace('&#233;', 'é').replace('&#232;', 'è').replace('<br>', ' ').replace('</p>', ' ').replace('Information Ile de France Mobilités :', ''))).strip(),
}
}],
@ -91,6 +91,7 @@ class IDFMAPI:
mode = "rers"
elif mode == "T":
mode = "tramways"
line = line[1:]
elif mode == "B":
mode = "buses"
elif mode == "N":
@ -194,7 +195,7 @@ class IDFMAPI:
draw.rounded_rectangle((0, 0, width, size), radius=4, fill=fill)
else:
draw.rectangle((0, 0, width, size), fill=fill)
draw.text((int(width / 2), int(size / 2)), line, fill="white" if (fill == "black" and mode == "tramways") or (fill != "white" and mode != "tramways") else "black", anchor="mm", font=fnt_icon)
draw.text((int(width / 2), int(size / 2)), line, fill="white" if (fill == "black" and mode == "tramways") or (fill != "white" and mode != "tramways") or (fill == "white" and mode == "tramways") else "black", anchor="mm", font=fnt_icon)
return image