Config für random station/die erste die zur auswahl steht

This commit is contained in:
Kaaninchen
2026-07-18 16:29:45 +02:00
parent 8145d0f2c7
commit e58d14dd14
4 changed files with 17 additions and 8 deletions
+5 -2
View File
@@ -38,13 +38,16 @@ def random_connection():
departures = [
d for d in data.get("departures", [])
if d.get("scheduledDeparture") and d.get("destination") != station
and not d.get("train", "").startswith("S ")
]
if not departures:
continue
dep = random.choice(departures)
if config['random']:
dep = random.choice(departures)
else:
dep = departures[0]
return {
"train": dep['train'],
"destination": dep['destination'],