Hack #97. Streaming Internet Audio Broadcasts to TiVo
Stream SHOUTcast Internet audio alongside your own MP3s to your HMO-enabled TiVo.
TiVo's Home Media Option (HMO) allows you to stream MP3 music from your home PC through your TiVo to your television and home audio system speakers. But what of those online music broadcasts, streamed talk shows, and specials? The HMO can handle those too, thanks to Tobias Hoellrich's m3ugen.pl(http://www.kahunaburger.com/blog/archives/000054.html).
m3ugen.pl is a simple Perl (http://www.perl.com) script that generates .m3u files from SHOUTcast playlists. These .m3u files are what TiVo uses to stream music from PCs and Macs in your house to TiVo.
The Code
Save the following code to a file named m3ugen.pl somewhere on your PC or Mac's hard drive:
#!c:\perl\bin\perl.exe use strict; use HTML::LinkExtor; use LWP::Simple; use URI::URL; use constant PROVIDER => qq{http://www.shoutcast.com/}; use constant DIRECTORY => PROVIDER.qq{directory/}; my $genre=$ARGV[0]; my $results=$ARGV[1]; my $outfile=$ARGV[2]; unless (defined($genre) && defined($results) && $results && $results <= 25 && defined($outfile)) { die qq{Usage:\t$0 [genre] [numresults] [outfile]\n}. qq{\tgenre=TopTen,House,Blues,Punk,...\n}. qq{\tnumresults=1..25\n}. qq{\toutfile=m3u output file\n}; } my @playlists=getPlaylists(DIRECTORY. qq{?sgenre=$genre&numresult=$results},PROVIDER); unless (scalar(@playlists)) { die "No results found - unable to create playlist\n"; exit(0); } @playlists=mapFor ...
Get Home Theater Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.