feat: added web server with currently playing song

This commit is contained in:
Felipe M 2025-05-13 12:27:01 +02:00
parent 1a4986f294
commit 7f16452a99
Signed by: fmartingr
GPG key ID: CCFBC5637D4000A8
12 changed files with 847 additions and 9 deletions

View file

@ -8,6 +8,7 @@ A Discord bot written in Go that plays random music from a Subsonic-compatible s
- Play random music in a Discord voice channel with real-time audio streaming
- Automatic audio format conversion for Discord compatibility
- Simple slash commands for controlling the jukebox
- Web interface for viewing current playback status
- Configurable through environment variables
## Requirements
@ -88,6 +89,8 @@ Configure the bot using environment variables with the `JUKEBOX_` prefix. You ca
- `JUKEBOX_SUBSONIC_VERSION`: Subsonic API version (default: `1.16.1`)
- `JUKEBOX_AUDIO_VOLUME`: Volume level from 0.0 to 1.0 for audio playback (default: `0.5`)
- `JUKEBOX_TIMEOUT_SEC`: HTTP request timeout in seconds (default: `30`)
- `JUKEBOX_WEB_ENABLED`: Enable the web interface (default: `true`)
- `JUKEBOX_WEB_ADDR`: Address and port for the web server (default: `:8080`)
### Sample .env File
@ -104,6 +107,8 @@ JUKEBOX_SUBSONIC_PASSWORD=your_subsonic_password
# JUKEBOX_SUBSONIC_VERSION=1.16.1
# JUKEBOX_AUDIO_VOLUME=0.5
# JUKEBOX_TIMEOUT_SEC=30
# JUKEBOX_WEB_ENABLED=true
# JUKEBOX_WEB_ADDR=:8080
```
## Troubleshooting
@ -148,6 +153,25 @@ The bot provides the following slash commands:
- `/jukebox play` - Starts playing random music from your Subsonic library
- `/jukebox stop` - Stops playing music and leaves the voice channel
- `/jukebox skip` - Skips the current song and plays the next one
- `/jukebox info` - Displays information about the currently playing song
### Web Interface
The bot includes a web interface that displays the current playback status. By default, it runs on port 8080 and can be accessed at:
```
http://your-server-ip:8080
```
The web interface features:
- Real-time updates when songs change or playback stops
- Current song information (artist, album, title, etc.)
- Responsive design that works on mobile and desktop
- No additional setup required - it works out of the box
You can configure the web interface using these environment variables:
- `JUKEBOX_WEB_ENABLED`: Set to `false` to disable the web interface
- `JUKEBOX_WEB_ADDR`: Change the address and port (e.g., `:8000` for port 8000)
## License