Difference between revisions of "Webradio"

From YobiWiki
Jump to navigation Jump to search
Line 78: Line 78:
 
mpc stop
 
mpc stop
 
(Remember that we don't use mpd to play music but only to handle playlists)
 
(Remember that we don't use mpd to play music but only to handle playlists)
* When need to update the DB: mpc update
+
* When need to update the DB:
  +
mpc update
   
 
===icecast2===
 
===icecast2===

Revision as of 11:27, 24 June 2007

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
  • Edit /etc/mpd.conf
    • point music_directory to your mp2s or make a symlink from /var/lib/mpd/music
    • define password for clients if you want
  • On the slug there is by default no soundcard but mpd cannot start without at least one output, we'll give it a dummy soundcard:
echo snd-dummy >> /etc/modules
modprobe snd-dummy
  • Generate DB
/etc/init.d/mpd stop
mpd --create-db
  • Launch mpd
/etc/init.d/mpd start
mpc stop

(Remember that we don't use mpd to play music but only to handle playlists)

  • When need to update the DB:
mpc update

icecast2

apt-get install icecast2
  • Edit /etc/icecast2/icecast.xml
    • Change passwords in <authentication>
    • Change <hostname> if it's relevant
  • Edit /etc/default/icecast2
    • ENABLE=true
/etc/init.d/icecast2 start

TODO

  • setup phpmp2?
  • auto upload of ripped CDs?