[sf-perl] One more reason why I use Perl...

Joe Brenner doom at kzsu.stanford.edu
Tue May 11 13:42:07 PDT 2010


yary <not.com at gmail.com> wrote:

> (I need to be pulling music for my radio show, not reading email...
> kzsu 1-4pm if you're within range of Palo Alto)

#!/usr/bin/perl
# hear                      doom at kzsu.stanford.edu
#                           May 18, 2004
#                     Rev:  May 11, 2010

use warnings;
use strict;
$|=1;

my %runstring =
  (
   kzsu     =>   'vlc http://kzsulive.stanford.edu/audio/kzsu-1-24.m3u',
   kzsu2    =>   'vlc http://kzsulive.stanford.edu/audio/kzsu-2-24.m3u',
   kfjc     =>   'vlc http://netcast2.kfjc.org:8972/listen.pls',
   kfjc2    =>   'vlc http://netcast4.kfjc.org:8974/listen.pls',
   kfjc3    =>   'vlc http://netcast6.kfjc.org/listen.pls',
   wusb     =>   "vlc http://stream.wusb.stonybrook.edu:8080",
   wbai     =>   "vlc http://stream.wbai.org:8000/24k.ogg.m3u",
   wbai2    =>   "vlc http://stream.wbai.org:8000/24k.m3u",
   wbai3    =>   "vlc http://stream.wbai.org:8000/64k.m3u",
   wrek     =>   "vlc http://www.wrek.org/stream/meta/www.WREK.org_live_24.m3u",
   wfmu     =>   "vlc http://www.wfmu.org/wfmu32.m3u",
   kdvs     =>   "vlc http://169.237.101.62:8000/kdvs128vorbis",
   kpfa     =>   "vlc http://kpfa.org/streams/kpfa_24k.m3u",
   kcea     =>   "vlc http://69.12.217.101:8000/listen.pls",
   kcea2    =>   "vlc http://69.12.217.101:8000/",
   wrct     =>   "vlc http://stream.wrct.org:8000/wrct-lo.ogg.m3u",
   wrct2    =>   "vlc http://stream.wrct.org:8000/wrct-hi.ogg.m3u",
   wrct3    =>   "vlc http://stream.wrct.org:8000/wrct-lo.mp3.m3u",
   wrct4    =>   "vlc http://stream.wrct.org:8000/wrct-hi.mp3.m3u",
   wobc     =>   "vlc http://132.162.36.191:8000/listen.m3u",
   wnyu     =>   "vlc http://wnyu.org/wnyu32.m3u",
   wnyu2    =>   "vlc http://wnyu.org/wnyu128.m3u",
   wkcr     =>   "vlc http://kanga.college.columbia.edu:8000/listen.pls",
   kexp     =>   "vlc http://kexp-mp3-1.cac.washington.edu:8000/listen.pls",
   kexp2    =>   "vlc http://kexp-mp3-128k.cac.washington.edu:8000/listen.pls",
  );
# flash based audio ghetto
#   klaw     =>   "",
#   ksjs     =>   "",
#   kxlu     =>   "",  live365: flash *and* javascript
#   kspc     =>   "",
#   kcrw     =>   "",  #  how the hell does *this* station work?

my $input = shift;
$input = '    ' unless ( $input );
if ( not exists $runstring{ $input } ) {
  print "Station id: $input is not recognized.  Usage: hear <station_id>.\n";
  print "Allowed ids are:\n";
  print join ' ', sort keys %runstring;
  print "\n";
  exit;
}

exec( $runstring{ $input } );


More information about the SanFrancisco-pm mailing list