--- date: "2003-11-23T06:45:19Z" title: Decoupled Icecast Streaming --- <p> I separated the <a href='http://www.icecast.org/'>Icecast</a> streaming for <a href='/radio/'>Pablotron Radio</a> from <a href='http://www.xmms.org/><acronym title='X Multimedia System'>XMMS</acronym></a>. I'm just using <code>shout</code> to queue files for the stream now. I also wrote a brief script which calls <a href='http://www.ignavus.net/software.html'><acronym title='X On-Screen Display'>XOSD</acronym></a> to notify me when a new song comes on. Here's the script: </p> <pre> #!/usr/bin/env ruby # some XOSD settings ENV['DISPLAY'] = ':0' FONT = "-adobe-helvetica-bold-r-normal-*-20-*-*-*-p-*-iso8859-2" # fork and exit so shout doesn't block pid = fork if pid Process::waitpid(pid, Process::WNOHANG) exit 0 end # make sure the cue file updates sleep 1 # read the cue file and pipe it to xosd File::open('/var/log/icecast/.cue', 'r') { |cue| name, size, rate, time, unknown, ofs = cue.readlines.map { |i| i.chomp } IO::popen("osd_cat -p bottom -f #{FONT} -s 1 -c \\#ffcc00", 'w') { |osd| osd.puts "#{time} - #{name}" } } </pre> <p> Why go through all this trouble? So I can use <a href='http://www.xmms.org/'><acronym title='X Multimedia System'>XMMS</acronym></a> to search for and preview songs locally, without messing with the active stream. Plus it's neat to have <a href='http://www.ignavus.net/software.html'><acronym title='X On-Screen Display'>XOSD</acronym></a> notifications for stuff :). </p>