[linux-dvb] [PATCH] make_atsc_chanconf.pl

Bob Igo Bob at StormLogic.com
Thu May 19 19:39:41 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry it too me so long to do this, but this is my formal patch
submission for a version of make_atsc_chanconf.pl (part of dvb-apps)
that does two minor new things:

1) It is updated to work again with antennaweb.  The old version of the
script no longer worked because of the new marketing and survey
checkboxes antennaweb put on the page.  The new code explicitly
un-checks them.

2) It allows the user to submit a zip+4 code, and encourages them to do
so if zip alone doesn't generate any listings.


Index: make_atsc_chanconf.pl
===================================================================
RCS file:
/cvs/linuxtv/dvb-apps/util/szap/channels-conf/atsc/make_atsc_chanconf.pl,v
retrieving revision 1.1
diff -u -p -r1.1 make_atsc_chanconf.pl
- --- make_atsc_chanconf.pl	5 Jan 2005 00:22:22 -0000	1.1
+++ make_atsc_chanconf.pl	19 May 2005 17:32:27 -0000
@@ -1,8 +1,11 @@
 #!/usr/bin/perl

- -# Angel Li sent me this script to help in setting up a
- -# ~/.azap/channels.conf file automagicly.  This probbably
- -# isn't the final version
+# Angel Li sent me this script to help set up an
+# ~/.azap/channels.conf file automagically.  This probably
+# isn't the final version.
+
+# 04/22/2005: Edits by Bob Igo (Bob at StormLogic.com) of the MythTV Store at
+# http://MythiC.TV to adapt the script to the new behavior on antennaweb.

  use LWP;
  use HTML::Form;
@@ -25,6 +28,9 @@
  );

  $ZIPCODE = 'txtZipcode';
+ $MARKETING = 'chkMarketing';
+ $SURVEYS = 'chkSurveys';
+
  $XML = 'stationXml';
  $WEBSITE = 'http://www.antennaweb.org';

@@ -32,8 +38,8 @@
  unless ($zipCode) {
  	die "Zipcode missing on the command line";
  }
- - unless ($zipCode =~ /^\d\d\d\d\d$/) {
- - 	die "Illegal zipcode: $zipCode";
+ unless (($zipCode =~ /^\d\d\d\d\d$/) || ($zipCode =~
/^\d\d\d\d\d\-\d\d\d\d$/)){
+ 	die "Illegal zipcode: $zipCode\nValid examples: 15001 or 15001-1015";
  }

  $ua = LWP::UserAgent->new;
@@ -46,6 +52,9 @@
  	if ($response2->is_success) {
  		$form2 = HTML::Form->parse($response2);
 		$form2->param($ZIPCODE, $zipCode);
+		$form2->param($MARKETING, "off");	
+		$form2->param($SURVEYS, "off");
+
  		$request2 = $form2->click;
  		$response3 = $ua->request($request2);
  		if ($response3->is_success) {
@@ -82,6 +91,7 @@
  	my($c);
  	my($psipChannel);
  	my($freq);
+	my($stationCount) = 0;

 	$xp = XML::XPath->new(xml => $xml);
  	foreach $s ($xp->find('//Station[BroadcastType="D"]')->get_nodelist) {
@@ -99,7 +109,12 @@
 		$freq = $ntsc[$channel]*1000000;
  		if ($freq) {
  			print $callSign, ":", $freq, ":8VSB:0:0\n";
+			$stationCount++;
  		}
  	}
  }
+        if ($stationCount <= 0) {
+                print STDERR "No digital stations found.  Try using
your ZIP+4 code.\n";
+        }
+
  }



Signed-off-by: Robert W Igo <bob at stormlogic.com>


- --
Bob Igo
StormLogic
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCjM9d65uO8u5kvxoRAigCAJ0YcFMqZAEEJjGejsZScCNoyP4TCwCdHd+c
4v4XQrnjx6dYy1iJgql5t+o=
=RS9E
-----END PGP SIGNATURE-----




More information about the linux-dvb mailing list