Webjay Alarm Clock

Here's a little script that will open a random playlist from Webjay. Set it to run at a certain time every morning (with a crontab addition like: 0 8 * * 1,2,3,4,5 /usr/local/bin/perl /Users/yourname/documents/webjay.pl ) and it makes a handy radio alarm clock.

#!/usr/local/bin/perl
use LWP::Simple;
$webjay = get('http://webjay.org');
while ( $webjay =~ m|href\=\"(.*?)\"|igs ){
    if (( $1 =~ m|^(http://webjay.org/by/.*?/.*?)$|i )
        && ( $1 !~ /#comments/i ))
            { push @playlists, $1 }
}
$play = rand(scalar(@playlists));
exec "open $playlists[$play].smil";
Be careful though, if you really need to wake up: SMIL playlists won't play in RealPlayer v<10 if they use progressive jpegs. You could change the .smil to .m3u, but then you're in danger of oversleeping if it picks a playlist that only contains videos.