aboutsummaryrefslogtreecommitdiffstats
path: root/util/szap/channels-conf/atsc
diff options
context:
space:
mode:
authorMark Purcell <msp@debian.org>2008-06-22 11:00:40 +1000
committeretobi <git@e-tobi.net>2013-09-03 09:48:42 +0200
commit891c51ff368ed700dec6025eeb47ce4d96f76418 (patch)
tree3729664829e4faa691d403274f38eb10890b533c /util/szap/channels-conf/atsc
parent1c6e1f28f54ec2606c23936c1d8689f2be55a86c (diff)
parentab959d7b4194715870128e616b8e29d4a101e488 (diff)
downloadlinux-dvb-apps-debian/1.1.1+rev1207-1.tar.gz
Imported Debian patch 1.1.1+rev1207-1debian/1.1.1+rev1207-1
Diffstat (limited to '')
-rwxr-xr-xutil/szap/channels-conf/atsc/make_atsc_chanconf.pl110
-rw-r--r--util/szap/channels-conf/atsc/us-Raleigh-Durham8
2 files changed, 118 insertions, 0 deletions
diff --git a/util/szap/channels-conf/atsc/make_atsc_chanconf.pl b/util/szap/channels-conf/atsc/make_atsc_chanconf.pl
new file mode 100755
index 0000000..a5168e2
--- /dev/null
+++ b/util/szap/channels-conf/atsc/make_atsc_chanconf.pl
@@ -0,0 +1,110 @@
+#!/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
+
+ use LWP;
+ use HTML::Form;
+ use HTTP::Cookies;
+ use XML::XPath;
+ use XML::XPath::XMLParser;
+
+ #$DEBUG = 1;
+
+ #
+ # Center frequencies for NTSC channels
+ #
+ @ntsc = (
+ 0, 0, 57, 63, 69, 79, 85, 177, 183, 189,
+ 195, 201, 207, 213, 473, 479, 485, 491, 497, 503,
+ 509, 515, 521, 527, 533, 539, 545, 551, 557, 563,
+ 569, 575, 581, 587, 593, 599, 605, 611, 617, 623,
+ 629, 635, 641, 647, 653, 659, 665, 671, 677, 683,
+ 689, 695, 701, 707, 713, 719, 725, 731, 737, 743,
+ 749, 755, 761, 767, 773, 779, 785, 791, 797, 803,
+ );
+
+ $ZIPCODE = 'txtZipcode';
+ $XML = 'stationXml';
+ $WEBSITE = 'http://www.antennaweb.org';
+
+ $zipCode = $ARGV[0];
+ unless ($zipCode) {
+ die "Zipcode missing on the command line";
+ }
+ unless ($zipCode =~ /^\d\d\d\d\d$/) {
+ die "Illegal zipcode: $zipCode";
+ }
+
+ $ua = LWP::UserAgent->new;
+ $ua->cookie_jar({});
+ push @{$ua->requests_redirectable}, 'POST';
+ $response = $ua->get($WEBSITE);
+ if ($response->is_success) {
+ $form = HTML::Form->parse($response);
+ $request = $form->click("btnStart");
+ $response2 = $ua->request($request);
+ if ($response2->is_success) {
+ $form2 = HTML::Form->parse($response2);
+ $form2->param($ZIPCODE, $zipCode);
+ $request2 = $form2->click("btnSubmit");
+ $response3 = $ua->request($request2);
+ $form3 = HTML::Form->parse($response3);
+ $request3 = $form3->click("btnContinue");
+ $response4 = $ua->request($request3);
+ if ($response4->is_success) {
+ $form4 = HTML::Form->parse($response4);
+ $xml = $form4->value($XML);
+ $xml =~ s/%22/"/g;
+ $xml =~ s/%2c/,/g;
+ $xml =~ s/%2f/\//g;
+ $xml =~ s/%3c/</g;
+ $xml =~ s/%3d/=/g;
+ $xml =~ s/%3e/>/g;
+ $xml =~ s/\+/ /g;
+ genConf($xml);
+ exit(0);
+ }
+ else {
+ print STDERR "Could not submit zipcode: $zipCode\n";
+ die $response3->status_line;
+ }
+ }
+ print STDERR "Could not reach zipcode page";
+ die $response2->status_line;
+ }
+ else {
+ print STDERR "Error reaching $WEBSITE\n";
+ die $response->status_line;
+ }
+
+ sub genConf {
+ my($xml) = @_;
+ my($s);
+ my($callSign);
+ my($channel);
+ my($c);
+ my($psipChannel);
+ my($freq);
+
+ $xp = XML::XPath->new(xml => $xml);
+ foreach $s ($xp->find('//Station[BroadcastType="D"]')->get_nodelist) {
+ if ($s->find('LiveStatus')->string_value eq "1") {
+ $callSign = $s->find('CallSign')->string_value;
+ $callSign =~ s/-DT//;
+ $channel = $s->find('Channel')->string_value; # Channel to tune
+ $psipChannel = $s->find('PsipChannel')->string_value;
+
+ if ($DEBUG) {
+ print STDERR $callSign, "\t", $channel, " -> ", $psipChannel, "\n";
+ }
+
+ $psipChannel =~ s/\.\d+$//;
+ $freq = $ntsc[$channel]*1000000;
+ if ($freq) {
+ print $callSign, ":", $freq, ":8VSB:0:0\n";
+ }
+ }
+ }
+ }
diff --git a/util/szap/channels-conf/atsc/us-Raleigh-Durham b/util/szap/channels-conf/atsc/us-Raleigh-Durham
new file mode 100644
index 0000000..48d14d2
--- /dev/null
+++ b/util/szap/channels-conf/atsc/us-Raleigh-Durham
@@ -0,0 +1,8 @@
+# Most of the major channels in the Raleigh Durham Area. Frequencies the NTSC center freq.
+WRAL:707000000:8VSB:33:36
+WNCN:719000000:8VSB:49:52
+WTVD:701000000:8VSB:49:52
+WRAZ:683000000:8VSB:49:52
+WUNC:743000000:8VSB:49:52
+WRDU:551000000:8VSB:33:36
+WLFL:731000000:8VSB:33:36