Files
winamp-mpris/GEMINI.md

53 lines
2.3 KiB
Markdown

# Winamp MPRIS Bridge
A Python-based bridge that provides an MPRIS2 interface for Winamp on Linux, specifically optimized for KDE Plasma 6. It allows Linux desktop environments to control Winamp and display track metadata by interacting with the Winamp Web Interface plugin.
## Project Overview
- **Purpose:** Bridges Winamp's Web Interface to the Linux MPRIS2 D-Bus specification.
- **Technologies:**
- **Python 3**: Core logic.
- **pydbus**: D-Bus communication.
- **requests**: Communicating with the Winamp Web Interface.
- **BeautifulSoup4**: Scraping metadata from the Web Interface's HTML.
- **PyGObject (GLib)**: Main event loop and signal handling.
- **Architecture:** The script runs a background thread that polls the Winamp Web Interface (default: `http://localhost:5666`) every 2 seconds, parses the HTML for metadata, and updates the D-Bus properties.
## Building and Running
### Prerequisites
Ensure you have the following Python libraries installed:
```bash
pip install requests pydbus beautifulsoup4 pygobject
```
You also need the `Winamp Web Interface` plugin installed and running in Winamp, configured with:
- **Base URL:** `http://localhost:5666`
- **Username:** `winamp`
- **Password:** `llama` (These are the current defaults in `winamp_mpris.py`)
### Running the Bridge
To start the bridge, run:
```bash
python3 winamp_mpris.py
```
The bridge will publish itself on D-Bus as `org.mpris.MediaPlayer2.winamp`.
## Key Files
- **`winamp_mpris.py`**: The main, active script. Includes optimizations for Plasma 6 property change detection and correct D-Bus signal emission.
- **`winamp_mpris_old.py`**: A previous iteration of the bridge.
- **`sample_Winamp Web Interface.html`**: A sample of the HTML returned by the Winamp Web Interface, used for reference in parsing logic.
## Development Conventions
- **D-Bus Interface:** Defined via XML introspection string within the `WinampMPRIS` class.
- **Polling:** Metadata is updated by polling the web interface every 2 seconds in a daemon thread.
- **Property Changes:** Uses the `PropertiesChanged` signal to notify the desktop environment of track or status updates.
- **Error Handling:** Basic try-except blocks handle network timeouts or parsing errors, defaulting to "Stopped" or "Offline" states.