Files
icyws/README.md
2025-12-09 21:19:33 -05:00

46 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# icyws
A tiny ices2 input module. It does two things:
* Runs a WebSocket server on port 8765 that broadcasts the current song as `Artist - Title`
* When run with no arguments, picks a random song from a newlineseparated file list, prints its full path, extracts metadata, and tells the WebSocket server
## Usage
### Start the server
```
icyws serve --bind :8765 --allow-origin *
```
### Pick a random track
```
ICYWS_TRACKLIST=tracks.txt icyws
```
This prints the selected file path to stdout and broadcasts the nowplaying info.
### Track list format
A plain text file with one absolute file path per line.
### ices2 config
```xml
<input>
<module>playlist</module>
<param name="type">script</param>
<param name="program">ICYWS_TRACKLIST=/etc/ices2/playlist.txt /usr/local/bin/icyws</param>
</input>
```
### WebSocket endpoint
Connect to: `/ws/radio`
Receives: `Artist - Title` whenever a new song is selected
### Announcement endpoint (internal)
If the websocket (serve mode) is live, picker mode POSTs to:
```
/announce
```
### Build
```
go build -o icyws
```