Webradio

From YobiWiki
Jump to navigation Jump to search

Intro

I was struggling to fit some requirements:

  • I ripped all my CDs on the HD attached to the slug
  • I wanted my Philips Streamium (which is not UPnP) to be able to play whatever I want
    • Streamium is not UPnP
    • Streamium doesn't understand Ogg format
    • Streamium has a very poor UI
  • I wanted to be able to control the playlist from any other computer in the house
  • Why not extending those possibilities from anywhere on the Net?

Resources

  • madplay/libmad (fixed point mp3 player)
    • In terms of codecs this is the only fixed-point lib available for the slug and it allows only mp3 playback.
  • musicdp, aka mpd (its faq)
    • That's THE solution to manage the playlists, now we need to cope with its playing capabilities...
  • http://www.nslu2-linux.org/wiki/HowTo/SlugAsAudioPlayer
    • With mpd and libmad, good idea but is using the slug soundcard (if you add one), not icecast
  • icecast2
    • The solution for streaming, if we find the right way to add a mp3 source to it.
  • mpd + icecast2
    • 2 problems: only streaming in Ogg and needs to reencode the stream, too much without a fixed point encoder!
  • oggfwd
    • Would solve one problem: does not reencode, but, as the name tells you, only Ogg.
  • EzStream
    • Good candidate, feeds icecast with mp3 without reencoding, but needs to be hooked to mpd
  • Ices and especially the versions 0.x
    • Same as for EzStream
  • Jinzora
    • To be explored... but requires php/mysql, maybe too much for the slug
  • Hack mpd with ices client
    • That's the best I could find: a Perl script as scriptable playlist for ices fetches the songs from mpd playlist ans streams them to icecast2
    • Ices in its basic configuration doesn't perform any reencoding
    • Note that the old version of ices is required as the new one supports only Ogg

Let's go

ices compilation

  • Debian features only ices2 so we've to compile the old version ourselves
apt-get install libshout3-dev libperl-dev libmp3-info-perl
wget http://downloads.us.xiph.org/releases/ices/ices-0.4.tar.gz
tar xzf ices-0.4.tar.gz 
cd ices-0.4
./configure --with-perl
make
cp src/ices /usr/local/bin
cp conf/ices.conf.dist /etc/ices.conf
wget -q -O - http://mpd.wikia.com/wiki/Hack:ices-client | awk '/<pre/,/<\/pre/'|html2text -width 200 > mpdplaylist.pm
  • Edit mpdplaylist.pm
    • my $mediaroot: points to your mp3 directory, must be identical to music_directory in /etc/mpd.conf but with trailing /
    • Add the following lines to use authentication for musicp clients (cf password in /etc/mpd.conf) or to connect to a remote mpd or a non default port
$ENV{'MPD_HOST'} = 'mypassword@localhost';
$ENV{'MPD_PORT'} = '6600';
  • Edit /etc/ices.conf
 <Playlist>
   <Type>perl</Type>
   <Module>mpdplaylist</Module>
 </Playlist>
Maybe you need to adapt also <Password> to match the icecast2 source pwd 
and the <Bitrate> but that's just for info as we won't recode the stream anyway.
  • ices -c /etc/ices.conf
  • TODO:
    • default playlist: get songs randomly from playlist file but don't install it in mpd
    • next song: killall -s USR1 ices
    • how to make it remotely?? through icecast2(php auth?) or mpd... icecast2 mount on-connect -> script: ices user?
    • ices crossfade?

mpd

  • apt-get install mpd mpc
  • /etc/mpd.conf
  • /etc/init.d/mpd stop
  • mpd --create-db
  • modprobe snd-dummy
  • /etc/init.d/mpd start
  • mpc stop
  • When need to update the DB: mpc update

icecast2

  • apt-get install icecast2
  • /etc/icecast2/...
  • /etc/default/icecast2 -> enabled=true

TODO

  • setup phpmp2?
  • auto upload of ripped CDs?