fm.pl



NAME

fm.pl


DESCRIPTION

Switch to radio station.

Note that 'fmtools' is needed.


COPYRIGHT

Copyright 2010 Etienne LEMEE <coding AT etilem DOT net>

This piece of code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


#!/usr/bin/perl -w

use strict;

chomp(my $p = qx(which fm));
die "is 'fmtools' installed on your system ?" unless(-x $p);

# Saint-Nazaire (FRANCE) frequencies.
my %sta = (
"alouette"                  => 106.5,
"europe 1"                  => 104.7,
"europe 2"                  => 99.3,
"fip"                       => 97.2,
"france bleu loire ocean"   => 88.1,
"france culture"            => 92.2,
"france info"               => 105.5,
"france inter"              => 95.2,
"france musiques"           => 102.6,
"fun radio"                 => 103.6,
"hit west"                  => 102.2,
"mfm"                       => 89.1,
"nostalgie"                 => 105.9,
"nrj"                       => 100.5,
"radio alternantes fm"      => 91.0,
"radio cote d'amour"        => 100.1,
"rfm"                       => 89.7,
"rmc info"                  => 93.7,
"rtl"                       => 104.3,
"skyrock"                   => 96.5,
);


print "Voici les stations :\n";

my $c = 0;
my @fre = ();

for (sort keys %sta) { 
    printf "%d: %s\n", ++$c, $_;
    push @fre, $sta{$_};
}   
    
printf "Votre choix (1-%d) : ", $c;

$c = <STDIN>;

system "$p $fre[--$c]";