Shoutcast server and cache

Hi,

I’m creating with friends a little website around a shoutcast radio. We have a JS and an iOS player.
Those player display the standard music metadata (title, artist, song art) but also additional data from our website like the suggestor, its rank, …
Those player display the current and the last 5 songs played.

The shoutcast API is suboptimal because you have to check every X seconds if the song has changed and it gives you mostly the file title being streamed.

How can i create an OTP ? app:

  • with a 5 second scheduler integrated
  • with a in memory fifo/queue store to save the last 5 songs played and the current song (and metadatas)

Between ETS, queue form erlang, genstage or task… i’m a bit lost

thanks

A GenServer returning a ‘timeout’ option of 5 seconds (5000 in milliseconds as I recall it takes) would be easy, just whenever you get the timeout then query and send the results to the listening process (say a Phoenix.PubSub or so for broadcasting to a web page).

You could just store it in ETS so everything can access it immediately.

1 Like