Skip to main content
Topic: Shoutcast Streaming (to Allplay Wifi speakers) (Read 879 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Shoutcast Streaming (to Allplay Wifi speakers)

I have a multi-room network of Qualcomm Allplay powered speakers, and they work great and sound fantastic, really are a better option than Sonos IMHO.  but like Sonos, sometimes the built in music service offerings are not suitable with your existing service (Allplay is pretty good, but doesn't support Google Music).

Anyway, I have mostly sorted out my Google Music requirement, thanks to Streamcast, and GmusicAPI and a RaspberryPI.

The only thing missing, is a shoutcast client that better suits my needs.   I am currently using ezstream, and using a fixed playlist of gmusic songs store locally.  I want to switch this to one dynamically populated.  I have sorted out the dyanamic population of the directory, but I need a shoutcast/icecast streaming client that can

  • Stream a directory of MP3 in random order
  • Notice when new songs are placed there are add them to the pool from which random songs are taken
  • Preferably (but not essential) be psuedo-random, where all songs will get played before others are repeated

Anyone know of a streamcast/icecast client capable of this?  Most are either too simplistic (ezcast), or way too complex and include features like DJ modes that vastly overcomplicate things.   I have searched around and not come up with much.

Worst-case, I could possibly fork ezstream and add fsnotify and dynamic m3u building and psuedo-random features, but I would rather use something off-the-shelf.


Re: Shoutcast Streaming (to Allplay Wifi speakers)

Reply #1
I am not sure if you use the right tool for the job. With the shoutcast protocol, the server is just a broadcaster/repeater of whatever it it sent, and when you talk about a shoutcast client, I am guessing you are really talking about the shoutcast source, not the player on your receiving end. (which is what I would call a shoutcast client).

So you are basically asking about a shoutcast source application that is able to work as a radio station with a randomization over the contents of a directory.
You seem to have found some options but that don't suit your rather simple needs, probably because the use case is a bit strange (why would you need the playlist to be dynamic from the contents of a directory, instead of preparing a playlist and modifying it on the go?. That makes it even easier for tracks to be random and not repeated until all them are played).
I believe it's really this "read the contents of the directory dynamically" part is what is giving you most of the difficulties in finding an alternative.

Finally, I wonder if you can't use an uPnP client/server for this, which would much better suit your needs. (I'm not really sure what is supported).

At last, I see they offer some type of API (not sure if it is just to control the speakers or what), but since you were also considering coding...

Re: Shoutcast Streaming (to Allplay Wifi speakers)

Reply #2
Sorry, yes, I meant source (it's a terminology thing, the source is also a client)..

I don't think my usecase is that odd, I don't want to manage the playlist on the server, I pin a track in Google Music, and my other scripts download and copy it to my music pool.

Anyway, I sort of cobbled something together using ezstream.  It's not ideal, it will build a playlist from a directory of music, randomise it, and then feed it to exstream, which will play the entire list and exit back to the calling script when it's done (setting no repeat in the config file, and specifying the randomised playlist.  It then loops this process, building the playlist each time around, adding any newly added tracks to the playlist.

There are two downsides

1/ The new tracks are only in the playlist after a complete runthough of the playlist
2/ If you are listening whilst a playlist gets to the end, it's possible your client will pause as the stream stops.

I was aware of the developer AllPlay SDK, but it's more to do with integrating into existing music services and apps, not creating the http music streams.

Code: [Select]
cd /usr/local/music/playlists

while :

#remove old playlists
rm -f /usr/local/music/staging/*

#build new m3u of music
find $musicdir -name "*.mp3" > $staging/songs.m3u

#randomize songs
sort -R $staging/songs.m3u > $staging/random-songs.m3u

ezstream -c myconfig.xml


If anyone has any better suggestions on how to achieve this, that would be much appreciated!

Re: Shoutcast Streaming (to Allplay Wifi speakers)

Reply #3
Had another bash at this (pun intended).

It seems ezstream has a signal you can send it to re-read the playlist.  So essentially all I need to do is rebuild the playlist and tell ezstream it's changed from a cron job.

Code: [Select]

#rebuild m3u and shuffle
find /media -name "*.mp3" | shuf > /media/playlist.m3u
#tell ezstream to refresh it's playlist
killall -HUP ezstream


Re: Shoutcast Streaming (to Allplay Wifi speakers)

Reply #5
I did look at LiquidSoap, but it failed to work on my RPI2 (running raspbian) that is doing the streaming, it just kept segfaulting, so got rid of it, it also seemed overly complicated for what I needed, and brought in lots of unwanted dependencies, which is never ideal on a headless system running from a sd card.

I have tweaked my setup, and now running this, and it seems to be working well enough so far.  I can copy files into a drop folder, and every hour a cron job checks that folder and signals ezstream to rebuild playlist if new stuff is there.

Code: [Select]

count=`ls -1 /media-drop/*.mp3 2>/dev/null | wc -l`
if [ $count != 0 ]
  echo "$count new files to add"
  mv /media-drop/*.mp3 /media/
  #rebuild m3u and shuffle
  find /media -name "*.mp3" | shuf > /media/playlist.m3u
  #tell ezstream to refresh it's playlist
  killall -HUP ezstream
  echo "No New Files"

SimplePortal 1.0.0 RC1 © 2008-2018