mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-07-21 19:52:47 +00:00
Config für random station/die erste die zur auswahl steht
This commit is contained in:
+2
-1
@@ -3,5 +3,6 @@
|
|||||||
"stations": [ "Berlin Hbf", "Hamburg Hbf", "München Hbf", "Amsterdam Centraal"],
|
"stations": [ "Berlin Hbf", "Hamburg Hbf", "München Hbf", "Amsterdam Centraal"],
|
||||||
"server": ,
|
"server": ,
|
||||||
"vc": ,
|
"vc": ,
|
||||||
"formatting": "🚅┇"
|
"formatting": "🚅┇",
|
||||||
|
"random": false
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
OPERATORS = {
|
OPERATORS = {
|
||||||
"fallback": {
|
"fallback": {
|
||||||
"unknown": True,
|
"unknown": True,
|
||||||
"logo": "https://images.emojiterra.com/google/noto-emoji/unicode-15/color/512px/1f686.png",
|
"logo": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQCVeC5E0mNNBKyQftQaFMzxIVkbDvEnSzWv07h_c8PdA&s=10",
|
||||||
"color": 0x087BBB
|
"color": 0xFFFFFF
|
||||||
},
|
},
|
||||||
"db_allgemein": {
|
"db_allgemein": {
|
||||||
"logo": "https://marketingportal.extranet.deutschebahn.com/resource/blob/13602522/c53f806b9df966e144010b276af72dd2/Bild_09-data.png",
|
"logo": "https://marketingportal.extranet.deutschebahn.com/resource/blob/13602522/c53f806b9df966e144010b276af72dd2/Bild_09-data.png",
|
||||||
@@ -32,8 +32,8 @@ OPERATORS = {
|
|||||||
"color": 0x0083BE
|
"color": 0x0083BE
|
||||||
},
|
},
|
||||||
"Bayerische Regiobahn": {
|
"Bayerische Regiobahn": {
|
||||||
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Logo_BRB_2015.svg/1920px-Logo_BRB_2015.svg.png",
|
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Bahnland_Bayern_Logo_2021.svg/500px-Bahnland_Bayern_Logo_2021.svg.png",
|
||||||
"color": 0xF61526
|
"color": 0x0095DB
|
||||||
},
|
},
|
||||||
"Abellio Rail Mitteldeutschland GmbH": {
|
"Abellio Rail Mitteldeutschland GmbH": {
|
||||||
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Abellio_logo.svg/1920px-Abellio_logo.svg.png",
|
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Abellio_logo.svg/1920px-Abellio_logo.svg.png",
|
||||||
@@ -42,6 +42,10 @@ OPERATORS = {
|
|||||||
"SBB": {
|
"SBB": {
|
||||||
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/SBB_logo_simplified.svg/960px-SBB_logo_simplified.svg.png",
|
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/SBB_logo_simplified.svg/960px-SBB_logo_simplified.svg.png",
|
||||||
"color": 0xEB0000
|
"color": 0xEB0000
|
||||||
|
},
|
||||||
|
"Nordbahn Eisenbahngesellschaft": {
|
||||||
|
"logo": "https://upload.wikimedia.org/wikipedia/commons/b/b5/Logo_Nordbahn_NAH.SH_Blau_positiv_final.png",
|
||||||
|
"color": 0x1A2848
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +55,7 @@ OPERATOR_ALIASES = {
|
|||||||
"DB Fernverkehr AG": OPERATORS["db_allgemein"],
|
"DB Fernverkehr AG": OPERATORS["db_allgemein"],
|
||||||
"DB Regio AG NRW": OPERATORS["db_allgemein"],
|
"DB Regio AG NRW": OPERATORS["db_allgemein"],
|
||||||
"DB Regio AG Nord": OPERATORS["db_allgemein"],
|
"DB Regio AG Nord": OPERATORS["db_allgemein"],
|
||||||
|
"DB Regio AG Südost": OPERATORS["db_allgemein"],
|
||||||
"SBB GmbH": OPERATORS["SBB"],
|
"SBB GmbH": OPERATORS["SBB"],
|
||||||
"Schweizerische Bundesbahnen SBB": OPERATORS["SBB"],
|
"Schweizerische Bundesbahnen SBB": OPERATORS["SBB"],
|
||||||
}
|
}
|
||||||
+1
-1
@@ -66,7 +66,7 @@ async def _schedule_next_umstieg(bot, arrival):
|
|||||||
wait_seconds = (arrival - datetime.now()).total_seconds()
|
wait_seconds = (arrival - datetime.now()).total_seconds()
|
||||||
if wait_seconds > 0:
|
if wait_seconds > 0:
|
||||||
remaining = str(timedelta(seconds=wait_seconds))
|
remaining = str(timedelta(seconds=wait_seconds))
|
||||||
logger(f"Um {arrival.strftime('%H:%M:%S')} gehts weiter (in {remaining.split(".")[0]})!...")
|
logger(f"SCHEDULER: Nächster Umstieg in {remaining.split(".")[0]} ({arrival.strftime('%H:%M:%S')})")
|
||||||
await asyncio.sleep(wait_seconds)
|
await asyncio.sleep(wait_seconds)
|
||||||
logger("Zug angekommen, wähle neue Verbindung...")
|
logger("Zug angekommen, wähle neue Verbindung...")
|
||||||
await rename_vc(bot)
|
await rename_vc(bot)
|
||||||
+4
-1
@@ -38,13 +38,16 @@ def random_connection():
|
|||||||
departures = [
|
departures = [
|
||||||
d for d in data.get("departures", [])
|
d for d in data.get("departures", [])
|
||||||
if d.get("scheduledDeparture") and d.get("destination") != station
|
if d.get("scheduledDeparture") and d.get("destination") != station
|
||||||
and not d.get("train", "").startswith("S ")
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if not departures:
|
if not departures:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if config['random']:
|
||||||
dep = random.choice(departures)
|
dep = random.choice(departures)
|
||||||
|
else:
|
||||||
|
dep = departures[0]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"train": dep['train'],
|
"train": dep['train'],
|
||||||
"destination": dep['destination'],
|
"destination": dep['destination'],
|
||||||
|
|||||||
Reference in New Issue
Block a user