A Python-based tool for streamers to display current Spotify track information and control playback via WebSocket for OBS Studio integration.
- Displays current Spotify track information (title, artist, album, progress)
- WebSocket server for OBS Studio integration
- Full playback control (play, pause, next, previous, volume, seek)
- Configuration file for customizing appearance and behavior
- Spotify authentication via web browser
- Console-based output (no GUI)
- Python 3.7+
- Spotify Developer Account
- Required Python packages (see requirements.txt)
- Create a Spotify Developer Account at https://developer.spotify.com/
- Create a new app and note the Client ID and Client Secret
- Add
http://localhost:8080/callbackas a Redirect URI in your Spotify app settings - Set environment variables:
SPOTIPY_CLIENT_ID=your_client_id_here SPOTIPY_CLIENT_SECRET=your_client_secret_here
pip install spotipy websocketsRun the widget:
python spotify_stream_widget.pyThe widget will open your browser for Spotify authentication. After authentication, it will start displaying track information and listen for WebSocket commands on port 8765.
The widget listens for commands on ws://localhost:8765:
{"command": "play"}- Start playback{"command": "pause"}- Pause playback{"command": "next"}- Skip to next track{"command": "previous"}- Go to previous track{"command": "volume", "value": 50}- Set volume (0-100){"command": "seek", "value": 30000}- Seek to position in milliseconds{"command": "status"}- Get current track status
The widget uses config.json for settings:
dark_mode: Enable/disable dark modesize: Size of the display (small, normal, big)progress_bar_style: Style of progress bar (blocks, continuous, marquee, off)progress_color: Color of progress barexport_mode: Enable/disable exporting track detailsapi_calls: Counter of API callslocal_dir: Directory for local songswindow_color: Color of the window
- Add a "Browser Source" to your OBS scene
- Set the URL to
ws://localhost:8765(or use a WebSocket plugin) - Configure the browser source to display the widget output
- Use the WebSocket commands to control playback from OBS
MIT License