In my liquidsoap getting started guide I show you how to use a simple text
based playlist. In this guide I wanted show you how to use request.dynamic to
build a playlist that is based on any function at all, not just reading a simple
text file. You could determine the next song by user votes, hitting some
arbitrary HTTP api, randomly, the results are limitless.
On datafruits I mostly use this to add the most recent podcasts to the playlist,
as well as mix in jingles every couple of tracks. Its actually a function that
calls a ruby script that connects to redis to determing the next track to play.
The script can really do anything, as long as it prints out the path to the next
song. Here is what my script looks like.
When I run the script:
I have to mark this source as fallible, since its calling an external script.
Then I hook this up to my normal fallback mechanism.
You can pass any function to request.dynamic. You typically enqueue a new song
You’ll see something like this in the logs.
Then this when the track finishes.
Since the script for enqueuing the next request can be any program, the
possibilities are really limitless here. The next track could be the result of a
tweet, a user request on a webpage, a telnet command, or anything else you can
think of. I will go into more possibilities in an upcoming post.
Modern Online Radio with Liquidsoap Book - Free Sample
Need more help with liquidsoap?
Can’t get your script to work?
I wrote a book to help you learn Liquidsoap. The book covers all aspects of liquidsoap, from getting started, to making dynamic streams, audio processing, video, customizing metadata, authentication, and more. The book is available for purchase now here!
You can get a free sample chapter of my book! Just enter your email address to subscribe to my mailing list and I'll send you a free PDF sample of the book in return.