Open Sophira opened 3 years ago
One solution is just read that switched directory and from that create playlist.m3u
#!/bin/bash
rm radio/playlist.m3u
find $1 -name "*.flac" -o -name "*.mp3" -print0 | while read -d $'\0' file
do
echo $file >> radio/playlist.m3u
done
call like this
./updateTunes.sh mydirectory
untested code
First off, thank you so much for Liquidsoap!
I want to set up a small, private stream in which a small number of users will have access to create/modify playlist directories in
~/playlists/
, and I'd like the stream to play from one of these directories at any given time but to allow the user to change which directory is being used to play from. I am using Liquidsoap v1.4.3 for amd64 via the .deb file download on the GitHub releases page.I've tried a few different methods, but all of them have some downsides:
I've tried making a
.m3u
file which has a single line in it pointing to the playlist directory to use, and then pointingplaylist()
to this withreload_mode = "watch"
. The Wikipedia article on the M3U format suggests that this should work in Example 2 of the Examples section, but in practice it seems like Liquidsoap treats it as a track and tries to open it as one rather than descending to play the files in the directory. I'm not sure if this is a bug in Liquidsoap, non-standard behaviour in other players, or simply an error in the wiki.I've tried replacing the
.m3u
file with a symlink to the playlist directory to use, and then usingln -sfn
to change where the symlink points to. This sort of works, but when I change the playlist and Liquidsoap finishes playing a file from the old playlist, I get this scary line in the log:So despite this seeming to do the right thing, I am assuming this is a Bad Idea.
I have tried using an
interactive.string
called "requested_playlist", and then including#{requested_playlist()}
in the playlist string. However, the string appears to be interpolated before it's passed toplaylist()
, so it never changes even when the interactive string is updated (and even if it was, the playlist would need to be reloaded).I have tried using an
interactive.string
combined with a custom protocol to forcerequested_playlist()
to be re-evaluated each time:This also kind of works, but unfortunately it's impossible to use
reload_mode = "watch"
with it because it is no longer a filesystem entry, so I have to use the method of reloading every 10 seconds, which I'd like to avoid if possible.Is there a method I'm missing? It seems like this is something that should be fairly simple to do, but it seems surprisingly difficult.