dnd-music-console/README.md

104 lines
2.5 KiB
Markdown
Raw Normal View History

2024-03-01 01:14:24 -08:00
# Croaker
2024-03-05 22:51:04 -08:00
2024-03-05 23:42:10 -08:00
A shoutcast audio player designed for serving D&D session music.
2024-03-01 01:14:24 -08:00
2024-03-10 00:17:38 -08:00
### Features
* Native streaming of MP3 sources direct to your shoutcast / icecast server
* Transcoding of anything your local `ffmpeg` installation can convert to mp3
* Playlists are built using symlinks
* Randomizes playlist order the first time it is cached
* Always plays `_theme.mp3` first upon switching to a playlist, if it exists
* Falls back to silence if the stream encounters an error
### Requirements
* A functioning shoutcast / icecast server
* Python >= 3.10
* ffmpeg
* libshout3-dev
2024-03-01 01:14:24 -08:00
## What? Why?
2024-03-05 22:51:04 -08:00
Because I run an online D&D game, which includes a background music stream for my players. The stream used to be served by liquidsoap and controlled by a bunch of bash scripts I cobbled together which are functional but brittle, and liquidsoap is a nightmare for the small use case. Also, this currently requires me to have a terminal window open to my media server to control liquidsoap directly, and I'd rather integrate the music controls directly with the rest of my DM tools, all of which run on my laptop.
2024-03-01 01:14:24 -08:00
*Now that is a powerful yak! -- Aesop Rock (misquoted)*
2024-03-10 00:17:38 -08:00
2024-03-01 01:14:24 -08:00
## Quick Start (Server)
This assumes you have a functioning icecast2 installation already.
```
% sudo apt install libshout3-dev
2024-03-01 01:14:24 -08:00
% mkdir -p ~/.dnd/croaker
% croaker setup > ~/.dnd/croaker/defaults
% vi ~/.dnd/croaker/defaults # adjust to taste
% croaker add session_start /music/session_start.mp3
% croaker add battle /music/battle/*.mp3
```
Now start the server, which will begin streaming the `session_start` playlist:
```
2024-03-05 22:51:04 -08:00
% croaker start
INFO Daemonizing controller on (localhost, 8003); pidfile and logs in ~/.dnd/croaker
2024-03-01 01:14:24 -08:00
```
2024-03-05 22:51:04 -08:00
Connnect to the command & control server:
2024-03-01 01:14:24 -08:00
```
2024-03-05 22:51:04 -08:00
% telnet localhost 8003
2024-03-10 00:17:38 -08:00
*Trying 127.0.0.1...*
*Connected to croaker.local.*
*Escape character is '^]'.*
help
PLAY PLAYLIST - Switch to the specified playlist.
LIST [PLAYLIST] - List playlists or contents of the specified list.
FFWD - Skip to the next track in the playlist.
HELP - Display command help.
KTHX - Close the current connection.
STOP - Stop the current track and stream silence.
STFU - Terminate the Croaker server.
2024-03-01 01:14:24 -08:00
```
2024-03-10 00:17:38 -08:00
List available playlists:
```
list
2024-03-01 01:14:24 -08:00
2024-03-10 00:17:38 -08:00
battle
adventure
session_start
2024-03-01 01:14:24 -08:00
```
2024-03-10 00:17:38 -08:00
Switch to battle music -- roll initiative!
```
play battle
2024-03-01 01:14:24 -08:00
OK
```
Skip this track and move on to the next:
```
2024-03-05 22:51:04 -08:00
FFWD
2024-03-01 01:14:24 -08:00
OK
```
2024-03-10 00:17:38 -08:00
Stop the music:
2024-03-01 01:14:24 -08:00
```
2024-03-05 22:51:04 -08:00
STOP
2024-03-10 00:17:38 -08:00
OK
```
Disconnect:
```
kthx
KBAI
2024-03-05 22:51:04 -08:00
Connection closed by foreign host.
2024-03-01 01:14:24 -08:00
```