Workaround to play internet radio on the jukebox player
Posted: Wed Aug 25, 2010 11:42 pm
OK, this is a little -- involved. However, it works, at least for me on Linux (Fedora).
I save the URL of the station in a .m3u file, and use mplayer to to play the streams. However, since mplayer can't write directly to STDOUT, we'll need a shell script to do this. It creates a named pipe, writes to it, and `cat`s the pipe. I modified this from a script used for Asterisk. Save the following as a shell script called mpstream in /var/subsonic/transcode:
Make sure mpstream is mode 755 (or at least executable by the user Subsonic runs as).
Under General settings, add .m3u to the Music Mask. Now add a transcoder for "m3u > wav" This just needs a single transcode step,
And that's it. Load and play your .m3u file and you should hear your stream. The .m3u files need to be saved with your music (mp3, flac, etc) files, NOT with playlists.
I save the URL of the station in a .m3u file, and use mplayer to to play the streams. However, since mplayer can't write directly to STDOUT, we'll need a shell script to do this. It creates a named pipe, writes to it, and `cat`s the pipe. I modified this from a script used for Asterisk. Save the following as a shell script called mpstream in /var/subsonic/transcode:
- Code: Select all
#!/bin/bash
PIPE="/tmp/subsonic-moh-pipe"
if [ -p $PIPE ]; then
pkill mplayer
rm $PIPE
fi
mknod $PIPE p
mplayer -quiet -really-quiet -ao pcm:file=$PIPE -playlist "$@" | cat $PIPE
rm $PIPE
Make sure mpstream is mode 755 (or at least executable by the user Subsonic runs as).
Under General settings, add .m3u to the Music Mask. Now add a transcoder for "m3u > wav" This just needs a single transcode step,
- Code: Select all
mpstream %s
And that's it. Load and play your .m3u file and you should hear your stream. The .m3u files need to be saved with your music (mp3, flac, etc) files, NOT with playlists.