Skip to content

bkubinszky/wien-ticker

Repository files navigation

Wien-Ticker 🚇 - under construction

A real-time Vienna public transport monitoring desktop widget that displays live departure times for U-Bahn, trams, and buses.

Features

  • Real-time Departures: Live countdown timers for all Vienna public transport
  • Multiple Stations: Monitor several stations simultaneously
  • Always-on-Top Widget: Stays visible while you work
  • Line Filtering: Choose specific lines and directions per station
  • System Tray Integration: Minimize to tray for clean desktop
  • Authentic Line Colors: Uses official Wiener Linien branding
  • Secure & Robust: Enterprise-grade error handling and security

Installation

Requirements

  • Python 3.8 or higher
  • Windows, macOS, or Linux

Quick Start

  1. Clone the repository:

    git clone https://github.com/yourusername/wien-ticker.git
    cd wien-ticker
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the application:

    python main.py

Usage

Adding Stations

  1. Click the settings icon (⚙️) in the header or right-click → Settings
  2. Search for your station (e.g., "Hietzing")
  3. Select the station from search results
  4. Choose which lines and directions to monitor
  5. Click "Add Station"

The main window will update within 30 seconds to show your new station.

Managing Stations

  • Remove Station: Select station in settings and click "Remove Station"
  • Filter Lines: When adding a station, select specific lines to monitor
  • Reposition Window: Drag the header to move the window anywhere on screen

System Tray

  • Minimize to Tray: Close the window (X button) to hide to system tray
  • Restore: Click the tray icon → Show
  • Quick Settings: Right-click tray icon → Settings
  • Exit: Right-click tray icon → Exit

Configuration

Configuration is stored in config.json:

{
  "stations": [
    {
      "name": "Hietzing U",
      "diva": "60201332",
      "lines": [
        {"line": "58A", "towards": "Hietzing U"}
      ]
    }
  ]
}

Manual Configuration

You can edit config.json directly if needed:

  • diva: Station ID from Wiener Linien API
  • lines: Array of line filters (omit to show all lines)

Architecture

Project Structure

wien-ticker/
├── main.py              # Main application & GUI
├── settings_ui.py       # Settings window
├── station_search.py    # Station search utilities
├── file_lock.py         # Cross-platform file locking
├── config.json          # User configuration
├── requirements.txt     # Python dependencies
├── logs/               # Application logs
│   └── wien-ticker.log
└── assets/             # Icons and images
    ├── icon.png
    ├── close.png
    └── settings.png

Key Components

  • Main App (main.py): Always-on-top widget with 30-second refresh
  • Settings UI (settings_ui.py): Station management interface (separate process)
  • File Locking (file_lock.py): Prevents config corruption during concurrent access
  • Logging: Rotating logs (1MB max, 5 backups)

Security Features

Specific Exception Handling: No bare except: blocks ✅ HTTPS Verification: All API calls validate SSL certificates ✅ File Locking: Prevents config corruption ✅ Thread Safety: Lock-based synchronization ✅ Subprocess Validation: Path traversal prevention ✅ Exponential Backoff: API rate limiting with jitter

API

Wien-Ticker uses the official Wiener Linien Open Government Data (OGD) API:

  • Realtime Monitor API: https://www.wienerlinien.at/ogd_realtime/monitor
  • Station Data CSV: https://data.wien.gv.at/csv/wienerlinien-ogd-haltestellen.csv

Rate limiting is handled automatically with exponential backoff (30s → 600s max).

Troubleshooting

No Stations Appear

  • Check your internet connection
  • Verify config.json contains valid station data
  • Check logs/wien-ticker.log for error messages

"HTTP 502 Server Error"

This means the Wiener Linien API is temporarily down. The app will automatically retry with exponential backoff.

"Timeout waiting for lock"

Another process is accessing config.json. Wait a moment and try again. If persistent:

  1. Close all Wien-Ticker windows
  2. Restart the application

Settings Changes Don't Appear

Changes take up to 30 seconds to appear. The app polls config.json every refresh cycle.

Development

Running from Source

# Install development dependencies
pip install -r requirements.txt

# Run the main application
python main.py

# Run settings window directly
python settings_ui.py

Code Quality

  • Type Hints: Functions include type annotations
  • Logging: Comprehensive logging with rotation
  • Error Handling: Specific exception types throughout
  • Constants: Magic numbers extracted to named constants

Testing

# Syntax check all Python files
python -m py_compile main.py settings_ui.py station_search.py file_lock.py

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Priorities

  • Real-time config detection (replace 30s polling)
  • Prevent multiple settings windows
  • Add visual loading states
  • Duplicate station prevention
  • Create executable with PyInstaller

Liability

This repository is provided for informational and experimental purposes only. The code is offered “as is”, without any warranties of any kind, express or implied. I make no guarantees regarding its correctness, reliability, or suitability for any purpose. Use of this code is entirely at your own risk. I assume no responsibility or liability for any damages, losses, or issues arising from its use, misuse, or inability to use the contents of this repository.

Acknowledgments

  • Wiener Linien: For providing the open data API
  • Vienna Open Data: For station information CSV

Roadmap

v1.1 (Planned)

  • ⏱️ Real-time config updates (watchdog)
  • 🔒 Singleton settings window
  • 📊 Visual loading indicators
  • 🚫 Duplicate station prevention

v1.2 (Future)

  • 📦 Standalone executable (PyInstaller)
  • 🎨 Customizable themes
  • ⚙️ UI-based settings (refresh interval, etc.)
  • 🔔 Desktop notifications for delays

Support

For bugs or feature requests, please open an issue on GitHub.


Made with ❤️ for Vienna commuters

About

"Real-time Vienna public transport desktop (Windows) widget"

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages