README.md (1090B)
1 # icyws 2 A tiny ices2 input module. It does two things: 3 * Runs a WebSocket server on port 8765 that broadcasts the current song as `Artist - Title` 4 * When run with no arguments: picks a random song from a newline-separated file list, prints the path to stdout. Then, extracts metadata and tells the WebSocket server 5 6 ## Usage 7 8 ### Start the server 9 ``` 10 icyws serve --bind :8765 --allow-origin * 11 ``` 12 13 ### Pick a random track 14 ``` 15 ICYWS_TRACKLIST=tracks.txt icyws 16 ``` 17 18 This prints the selected file path to stdout and broadcasts the now-playing info. 19 20 ### Track list format 21 A plain text file with one absolute file path per line. 22 23 ### ices2 config 24 ```xml 25 <input> 26 <module>playlist</module> 27 <param name="type">script</param> 28 <param name="program">ICYWS_TRACKLIST=/etc/ices2/playlist.txt /usr/local/bin/icyws</param> 29 </input> 30 ``` 31 32 ### WebSocket endpoint 33 Connect to: `/ws/radio` 34 35 Receives: `Artist - Title` whenever a new song is selected 36 37 ### Announcement endpoint (internal) 38 If the websocket (serve mode) is live, picker mode POSTs to: `/announce` 39 40 ### Build 41 ``` 42 go build -o icyws 43 ```