in reply to Re: AM Radio Station Finder
in thread AM Radio Station Finder

THANKS for the link!

I was able to use Autrijus Tang's wonderful PAR to make an executable version of this script for Windows, without the need to have Perl installed on the end user's machine, though I had to split the data into a separate file. (Couldn't get PAR to recognize the data in the form of embedded data after the __END__ line.)

The zip file containing the Windows executable and the data file can be downloaded here.

Dave

Replies are listed 'Best First'.
Re^3: AM Radio Station Finder
by jdporter (Paladin) on Dec 22, 2005 at 16:04 UTC

    Rather than require the data to be local, why don't you make your perl script fetch the data from the web, real time? You could even have it cache the data locally, with expiration, etc.

    We're building the house of the future together.
      Cool idea!

      The data file is many megs in size; it basically covers anything you might hear on the AM band at night, not just the U.S. and Canada. So it took about a minute for it to download to my local installation.

      I like the idea of downloading the current data, in order to have the most recent information... your link worked great!

      I was actually able to revise the script in only about 15 minutes' time... maybe I'm starting to know what I'm doing! Thanks for the opportunity to stretch my programming legs.

      Here are the only changes I needed to make:

      # old # use Fcntl qw( :flock ); # new use LWP::Simple; # old # open my $fh, '<', 'stations.dat' # or die "Trouble opening stations.dat; is it in same directory as + stations.exe? Stopped: $!"; # flock $fh, LOCK_SH # or die "Trouble getting file lock for stations.dat; is it in use + by another program? Stopped: $!"; # # while (my $line =~ <$fh>) { # new my $stations_data = get( 'http://www.fcc.gov/fcc-bin/amq?state=&call=& +arn=&city=&freq=530&fre2=1700&type=0&facid=&class=&list=4&dist=&dlat2 +=&mlat2=&slat2=&NS=N&dlon2=&mlon2=&slon2=&EW=W&size=9' ); my @data_lines = split /\n/, $stations_data; LINE: foreach my $line (@data_lines) { next LINE unless ($line =~ /\|/); # old (later in the script) # close $fh; # new (delete that line)

      ---

      THANKS again! Maybe I'll give a try at storing the data I've collected through LWP::Simple.

      Dave