mirror of
https://github.com/skoelle/mvg-departures.git
synced 2026-09-17 18:40:23 +00:00
README.md
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
title: "MVG Departures"
|
||||
emoji: "🚇"
|
||||
category: code
|
||||
subcategory: "Smart Home Apps"
|
||||
status: active
|
||||
stack: [Python, FastAPI, Uvicorn, Jinja2]
|
||||
@@ -1,24 +1,24 @@
|
||||
# mvg-departures
|
||||
# 🚇 mvg-departures
|
||||
|
||||
Kompakter Abfahrtsmonitor fuer MVG U-Bahn und S-Bahn (Muenchen), primaer fuer mobile Nutzung optimiert.
|
||||
|
||||
## Features
|
||||
|
||||
- Konfigurierbare Stationsliste (`config.yaml`) mit Typ (UBAHN/SBAHN/TRAM/BUS)
|
||||
- Ausschluss-Filter pro Station: nur unerwuenschte Zielrichtungen werden ausgeblendet,
|
||||
neue/unbekannte Ziele werden automatisch weiter angezeigt
|
||||
- Profile zur Gruppierung von Stationen (z.B. "Hinfahrt" und "Rückfahrt")
|
||||
- Klickbare Kacheln zum Profilwechsel (nur bei >1 Profil)
|
||||
- URL-Param `?profile=<name>` + Auto-Refresh
|
||||
- Zwei Endpunkte:
|
||||
- `/` — mobile-optimierte HTML-Ansicht mit Auto-Refresh (alle 60s per Meta-Refresh)
|
||||
- `/api/departures` — JSON-Ausgabe derselben Daten
|
||||
- Anzeige von Linie, Ziel, Abfahrtszeit, Verspaetung und Stoerungsmeldungen
|
||||
- Visuelle Unterscheidung von U-Bahn (blau) und S-Bahn (gruen) per Icon
|
||||
|
||||

|
||||
|
||||
## Konfiguration
|
||||
## ✨ Features
|
||||
|
||||
- 🗺️ Konfigurierbare Stationsliste (`config.yaml`) mit Typ (UBAHN/SBAHN/TRAM/BUS)
|
||||
- 🚫 Ausschluss-Filter pro Station: nur unerwuenschte Zielrichtungen werden ausgeblendet,
|
||||
neue/unbekannte Ziele werden automatisch weiter angezeigt
|
||||
- 👤 Profile zur Gruppierung von Stationen (z.B. "Hinfahrt" und "Rückfahrt")
|
||||
- 🖱️ Klickbare Kacheln zum Profilwechsel (nur bei >1 Profil)
|
||||
- 🔗 URL-Param `?profile=<name>` + Auto-Refresh
|
||||
- 🌐 Zwei Endpunkte:
|
||||
- `/` — mobile-optimierte HTML-Ansicht mit Auto-Refresh (alle 60s per Meta-Refresh)
|
||||
- `/api/departures` — JSON-Ausgabe derselben Daten
|
||||
- 📊 Anzeige von Linie, Ziel, Abfahrtszeit, Verspaetung und Stoerungsmeldungen
|
||||
- 🎨 Visuelle Unterscheidung von U-Bahn (blau) und S-Bahn (gruen) per Icon
|
||||
|
||||
## ⚙️ Konfiguration
|
||||
|
||||
Siehe `config.yaml`:
|
||||
|
||||
@@ -51,21 +51,21 @@ profiles:
|
||||
NICHT in der Liste steht, wird angezeigt — so fallen Linienaenderungen/Umleitungen
|
||||
sofort auf, statt lautlos verschwunden zu sein.
|
||||
|
||||
## Lokal starten
|
||||
## 🏃 Lokal starten
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
uvicorn app.main:app --reload
|
||||
```
|
||||
|
||||
## Docker
|
||||
## 🐳 Docker
|
||||
|
||||
```bash
|
||||
docker build -t mvg-departures .
|
||||
docker run -p 8000:8000 -e TZ=Europe/Berlin -v $(pwd)/config.yaml:/app/config.yaml mvg-departures
|
||||
```
|
||||
|
||||
## Deployment
|
||||
## 🚀 Deployment
|
||||
|
||||
Siehe `docker-compose.yml` im Repo als Referenz. Beispiel (Owner anpassen):
|
||||
|
||||
@@ -85,28 +85,28 @@ services:
|
||||
- "com.centurylinklabs.watchtower.enable=true"
|
||||
```
|
||||
|
||||
## CI/CD
|
||||
## 🔄 CI/CD
|
||||
|
||||
`.github/workflows/build.yml`:
|
||||
|
||||
- Baut bei jedem Push auf `main` das Docker-Image und pusht es nach
|
||||
- 🏗️ Baut bei jedem Push auf `main` das Docker-Image und pusht es nach
|
||||
`ghcr.io/<owner>/<repo>:latest` sowie mit Short-SHA-Tag
|
||||
- Anschliessender Cleanup-Job loescht alte Image-Versionen in der GHCR-Package-Registry
|
||||
- 🧹 Anschliessender Cleanup-Job loescht alte Image-Versionen in der GHCR-Package-Registry
|
||||
und behaelt nur die letzten 4 Versionen (`min-versions-to-keep: 4`)
|
||||
|
||||
### Voraussetzung
|
||||
### 📋 Voraussetzung
|
||||
|
||||
Repo-Settings → Actions → General → Workflow permissions auf
|
||||
"Read and write permissions" stellen, sonst schlaegt der Push nach GHCR fehl.
|
||||
|
||||
## mvg api
|
||||
## 📡 mvg api
|
||||
|
||||
https://www.mvg.de/api/bgw-pt/v3/locations?query=Josephsburg \
|
||||
https://www.mvg.de/api/bgw-pt/v3/locations?query=Berg%20am \
|
||||
https://www.mvg.de/api/bgw-pt/v3/departures?globalId=de:09162:1220&limit=10&transportTypes=UBAHN \
|
||||
https://www.mvg.de/api/bgw-pt/v3/departures?globalId=de:09162:910&limit=10&transportTypes=SBAHN
|
||||
|
||||
## Endpunkte
|
||||
## 🔌 Endpunkte
|
||||
|
||||
| Route | Beschreibung |
|
||||
|---|---|
|
||||
@@ -116,7 +116,7 @@ https://www.mvg.de/api/bgw-pt/v3/departures?globalId=de:09162:910&limit=10&trans
|
||||
| `/api/departures?profile=<name>` | JSON-Liste für ein bestimmtes Profil |
|
||||
| `/healthz` | Healthcheck fuer Docker/Watchtower |
|
||||
|
||||
## Projektstruktur
|
||||
## 📁 Projektstruktur
|
||||
|
||||
```
|
||||
mvg-departures/
|
||||
@@ -139,28 +139,28 @@ mvg-departures/
|
||||
└── build.yml # CI/CD: Docker-Build + GHCR-Push
|
||||
```
|
||||
|
||||
## Tech-Stack
|
||||
## 🛠️ Tech-Stack
|
||||
|
||||
- **Runtime**: Python 3.14
|
||||
- **Framework**: FastAPI + Uvicorn
|
||||
- **Templating**: Jinja2 (server-seitig)
|
||||
- **MVG-API**: `mvg` Python-Client (oeffentlich, kein Auth noetig)
|
||||
- **Config**: YAML via `pyyaml`
|
||||
- **Container**: Docker (python:3.14-slim)
|
||||
- ⚡ **Runtime**: Python 3.14
|
||||
- 🚀 **Framework**: FastAPI + Uvicorn
|
||||
- 🎨 **Templating**: Jinja2 (server-seitig)
|
||||
- 🚇 **MVG-API**: `mvg` Python-Client (oeffentlich, kein Auth noetig)
|
||||
- ⚙️ **Config**: YAML via `pyyaml`
|
||||
- 🐳 **Container**: Docker (python:3.14-slim)
|
||||
|
||||
## Caching
|
||||
## 💾 Caching
|
||||
|
||||
- **Station-ID**: In-memory Dict, lifetime=Session (loest Station-Namen auf)
|
||||
- **Abfahrten**: In-memory Dict, TTL=`cache_seconds` (Default: 20s) pro Station+Typ
|
||||
- Keine Persistenz → Neustart = Cache-Verlust
|
||||
- 🆔 **Station-ID**: In-memory Dict, lifetime=Session (loest Station-Namen auf)
|
||||
- ⏱️ **Abfahrten**: In-memory Dict, TTL=`cache_seconds` (Default: 20s) pro Station+Typ
|
||||
- 🔄 Keine Persistenz → Neustart = Cache-Verlust
|
||||
|
||||
## Einschraenkungen
|
||||
## ⚠️ Einschraenkungen
|
||||
|
||||
- Kein WebSocket/Live-Updates (nur periodischer Meta-Refresh)
|
||||
- Keine Datenbank (nur In-Memory)
|
||||
- Kein Test-Framework vorhanden
|
||||
- Ein `config.yaml` pro Deployment (kein Multi-Tenancy)
|
||||
- 📡 Kein WebSocket/Live-Updates (nur periodischer Meta-Refresh)
|
||||
- 💽 Keine Datenbank (nur In-Memory)
|
||||
- 🧪 Kein Test-Framework vorhanden
|
||||
- 📄 Ein `config.yaml` pro Deployment (kein Multi-Tenancy)
|
||||
|
||||
## Lizenz
|
||||
## 📜 Lizenz
|
||||
|
||||
MIT License - Copyright (c) 2026 Stefan Koelle (https://stefankoelle.de)
|
||||
|
||||
Reference in New Issue
Block a user