Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: AM Radio Station Finder

by jdporter (Paladin)
on Dec 22, 2005 at 02:40 UTC ( [id://518464]=note: print w/replies, xml ) Need Help??


in reply to AM Radio Station Finder

Here's a link to the actual data.

We're building the house of the future together.

Replies are listed 'Best First'.
Re^2: AM Radio Station Finder
by davebaker (Pilgrim) on Dec 22, 2005 at 13:26 UTC
    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

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://518464]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-18 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found