#!/usr/bin/perl
BEGIN{$^W=1}
use strict;
open STDOUT, "|tee CATV_channels.html" or die;
# http://tv.yahoo.com/grid?lineup=us_IL12561&genres=&all=1&dur=&starttime=&starthour=&startdate=&.intl=us
my $channels = <<'EOF';
2 WBBM CBS
#3 -LOOR003 local origination
3 WJYS
4 WSNS Telemundo
5 WMAQ NBC
6 WGBO Univision
7 WLS ABC
8 WPWR UPN
9 WGN WB
10 WMVS PBS
11 WTTW PBS
12 WFLD FOX
13 WCIU
14 -QVC QVC
15 WCPX PAX
16 -FAM ABC Family
17 -PUAC017 public access
#18 WJYS
18 -LOOR018 Lake County TV
#19 -LOOR019 local origination
19 -PUAC019 public access
20 WYCC PBS
21 -ESPNCL ESPN Classic
22 WXFT Univision
23 -FX FX
23 -GALA Galavision
24 -CNBC CNBC
25 -LOOR025 local origination
26 -PIN Product Information Network
#27 MAX CineMAX
27 -HSN Home Shopping Network
#28 STARZ
#29 CLTV
30 -COMEDY Comedy Channel
31 -GOLF Golf Channel
#31 -FX FX
32 -TBS TBS / Superstation
33 -DSC Discovery Channel
34 -AMC AMC
35 -THC Weather Channel
36 -CNNH CNN Headline News
37 -CNN CNN
#37 -CSNCH Comcast Sportsnet Chicago
38 -TOON Cartoon Network
39 -HALMRK Hallmark Channel
40 -FSCH Fox Sports
41 -ESPN ESPN
42 -ESPN2 ESPN2
43 -SPIKETV SpikeTV
44 -CMTV CMT
#44 -QVC QVC
45 -MTV MTV
46 -BET BET
47 -DISN Disney Channel
48 -NIK Nickelodeon
49 -TLC TLC
50 -A&E A&E
51 -USA USA
52 -TNT TNT
#53 - Lifetime
53 -CLTV Chicagoland Television News
54 -FNC Fox News Channel
55 -CNN CNN
#57 -CSPAN CSPAN
#58 -EWTN Eternal Word Television Network
58 -COURT CourtTV
59 -VH1 VH-1
60 -ETV E! Entertainment Television
#61 - TBN (Trinity Broadcasting Network
#61 - VH-1
61 -FOOD Food Network
62 -TRAV Travel Channel
63 -OXYGEN Oxygen
64 -TVLAND TV Land
65 -MSNBC MSNBC
67 -SHOPNBC ShopNBC
68 -ANIMAL Animal Planet
69 -LIFE Lifetime
71 -CMP Cable Marketplace
72 -GALA Galavision
73 -BRAVO BRAVO
74 -HISTORY History Channel
75 -TLNCHIC Total Living Network
76 -OLN Outdoor Life Network
77 -CSPAN2 CSPAN2
95 -CSPAN CSPAN
96 -EWTN Eternal Word Television Network
99 -TVGO TV Guide Channel
EOF
my %callsigns = qw[
WBBM http://www.cbs2chicago.com/
WLS http://abclocal.go.com/wls/
WSNS http://www.telemundochicago.com/index.html
WGBO http://www.univision.com/content/channel.jhtml?chid=9627&schid=9628&secid=0
WCIU http://www.wciu.com/main.asp
WCPX http://www.paxchicago.tv/
WYCC http://wycc.ccc.edu/
CLTV http://cltv.trb.com/
WXFT http://www.univision.com/content/channel.jhtml?chid=9627&schid=9628&secid=0
WMVS http://www.mptv.org/
WTTW http://www.wttw.com/
WMAQ http://www.nbc5.com/
WGN http://wgntv.trb.com/
WFLD http://www.foxchicago.com/
WPWR http://www.foxchicago.com/
PUAC017 http://accesschannel.com/
LOOR018 http://www.co.lake.il.us/referendum/events/lctv.asp
PUAC019 http://accesschannel.com/
WJYS http://svartifoss2.fcc.gov/cgi-bin/ws.exe/prod/cdbs/pubacc/prod/sta_det.pl?Facility_id=32334
FAM http://abcfamily.go.com/home.html
SPIKETV http://www.spiketv.com/home/
PIN http://www.pinnet.com/
AMC http://www.amctv.com/
HALMRK http://www.hallmarkchannel.com/
TLNCHIC http://www.tln.com/
OLN http://www.olntv.com/
EWTN http://www.ewtn.com/
QVC http://www.qvc.com/
FX http://www.fxnetworks.com/
ESPNCL http://espn.go.com/classic/
TBS http://tbssuperstation.com/
BRAVO http://www.bravotv.com/
FNC http://www.foxnews.com/
TVGO http://www.tvguide.com/
OXYGEN http://www.oxygen.com/
TVLAND http://www.tvland.com/
HSN http://www.hsn.com/
SHOPNBC http://www.shopnbc.com/
CNNH http://www.cnn.com/HLN/
TRAV http://travel.discovery.com/
THC http://www.weather.com/
GOLF http://www.thegolfchannel.com/
CMTV http://www.cmt.com/
CNBC http://moneycentral.msn.com/cnbc/tv/
COMEDY http://www.comedycentral.com/
DSC http://dsc.discovery.com/
CNN http://www.cnn.com/CNN/Programs/
TOON http://www.cartoonnetwork.com/
FSCH http://www.foxsports.com/
ESPN http://espn.go.com/tvlistings/networks/espn.html
ESPN2 http://espn.go.com/tvlistings/networks/espn2.html
MTV http://www.mtv.com/
BET http://www.bet.com/
DISN http://disney.go.com/disneychannel/
NIK http://www.nick.com/
TLC http://tlc.discovery.com/
A&E http://www.aetv.com/
USA http://www.usanetwork.com/
TNT http://www.tnt.tv/
CSPAN http://www.c-span.org/
CSPAN2 http://www.c-span.org/
COURT http://www.courttv.com/
VH1 http://www.vh1.com/
ETV http://www.eonline.com/
FOOD http://www.foodtv.com/
MSNBC http://www.msnbc.com/
ANIMAL http://animal.discovery.com/
LIFE http://www.lifetimetv.com/
HISTORY http://www.historychannel.com/
GALA http://www.galavision.com/
];
my $yahoo_lineups = <<'EOF';
http://tv.yahoo.com/tvpdb?d=tvs&id=166031022&channels=us_WBBM&lineup=us_IL12561&.intl=us CBS 2
http://tv.yahoo.com/tvpdb?d=tvs&id=166033972&channels=us_LOOR003&lineup=us_IL12561&.intl=us LOOR003 3
http://tv.yahoo.com/tvpdb?d=tvs&id=166031803&channels=us_WJYS&lineup=us_IL12561&.intl=us WJYS 3
http://tv.yahoo.com/tvpdb?d=tvs&id=166031529&channels=us_WSNS&lineup=us_IL12561&.intl=us WSNS 4
http://tv.yahoo.com/tvpdb?d=tvs&id=166031364&channels=us_WMAQ&lineup=us_IL12561&.intl=us NBC 5
http://tv.yahoo.com/tvpdb?d=tvs&id=166031171&channels=us_WGBO&lineup=us_IL12561&.intl=us WGBO 6
http://tv.yahoo.com/tvpdb?d=tvs&id=166031348&channels=us_WLS&lineup=us_IL12561&.intl=us ABC 7
http://tv.yahoo.com/tvpdb?d=tvs&id=166031479&channels=us_WPWR&lineup=us_IL12561&.intl=us UPN 8
http://tv.yahoo.com/tvpdb?d=tvs&id=166031184&channels=us_WGN&lineup=us_IL12561&.intl=us WB 9
http://tv.yahoo.com/tvpdb?d=tvs&id=166031392&channels=us_WMVS&lineup=us_IL12561&.intl=us PBS 10
http://tv.yahoo.com/tvpdb?d=tvs&id=166031582&channels=us_WTTW&lineup=us_IL12561&.intl=us PBS 11
http://tv.yahoo.com/tvpdb?d=tvs&id=166031148&channels=us_WFLD&lineup=us_IL12561&.intl=us FOX 12
http://tv.yahoo.com/tvpdb?d=tvs&id=166031067&channels=us_WCIU&lineup=us_IL12561&.intl=us WCIU 13
http://tv.yahoo.com/tvpdb?d=tvs&id=166030925&channels=us_QVC&lineup=us_IL12561&.intl=us QVC 14
http://tv.yahoo.com/tvpdb?d=tvs&id=166032600&channels=us_WCPX&lineup=us_IL12561&.intl=us WCPX 15
http://tv.yahoo.com/tvpdb?d=tvs&id=166030317&channels=us_FAM&lineup=us_IL12561&.intl=us FAM 16
http://tv.yahoo.com/tvpdb?d=tvs&id=166034138&channels=us_PUAC017&lineup=us_IL12561&.intl=us PUAC017 17
http://tv.yahoo.com/tvpdb?d=tvs&id=166031803&channels=us_WJYS&lineup=us_IL12561&.intl=us WJYS 18
http://tv.yahoo.com/tvpdb?d=tvs&id=166033987&channels=us_LOOR018&lineup=us_IL12561&.intl=us LOOR018 18
http://tv.yahoo.com/tvpdb?d=tvs&id=166033988&channels=us_LOOR019&lineup=us_IL12561&.intl=us LOOR019 19
http://tv.yahoo.com/tvpdb?d=tvs&id=166034140&channels=us_PUAC019&lineup=us_IL12561&.intl=us PUAC019 19
http://tv.yahoo.com/tvpdb?d=tvs&id=166031677&channels=us_WYCC&lineup=us_IL12561&.intl=us PBS 20
http://tv.yahoo.com/tvpdb?d=tvs&id=166032064&channels=us_ESPNCL&lineup=us_IL12561&.intl=us ESPNCL 21
http://tv.yahoo.com/tvpdb?d=tvs&id=166052408&channels=us_WXFT&lineup=us_IL12561&.intl=us WXFT 22
http://tv.yahoo.com/tvpdb?d=tvs&id=166031893&channels=us_FX&lineup=us_IL12561&.intl=us FX 23
http://tv.yahoo.com/tvpdb?d=tvs&id=166030368&channels=us_GALA&lineup=us_IL12561&.intl=us GALA 23
http://tv.yahoo.com/tvpdb?d=tvs&id=166030346&channels=us_CNBC&lineup=us_IL12561&.intl=us CNBC 24
http://tv.yahoo.com/tvpdb?d=tvs&id=166033994&channels=us_LOOR025&lineup=us_IL12561&.intl=us LOOR025 25
http://tv.yahoo.com/tvpdb?d=tvs&id=166032234&channels=us_PIN&lineup=us_IL12561&.intl=us PIN 26
http://tv.yahoo.com/tvpdb?d=tvs&id=166030334&channels=us_MAX&lineup=us_IL12561&.intl=us MAX 27
http://tv.yahoo.com/tvpdb?d=tvs&id=166030386&channels=us_HSN&lineup=us_IL12561&.intl=us HSN 27
http://tv.yahoo.com/tvpdb?d=tvs&id=166031855&channels=us_STARZ&lineup=us_IL12561&.intl=us STARZ 28
http://tv.yahoo.com/tvpdb?d=tvs&id=166031723&channels=us_CLTV&lineup=us_IL12561&.intl=us CLTV 29
http://tv.yahoo.com/tvpdb?d=tvs&id=166030350&channels=us_COMEDY&lineup=us_IL12561&.intl=us COMEDY 30
http://tv.yahoo.com/tvpdb?d=tvs&id=166031940&channels=us_GOLF&lineup=us_IL12561&.intl=us GOLF 31
http://tv.yahoo.com/tvpdb?d=tvs&id=166031893&channels=us_FX&lineup=us_IL12561&.intl=us FX 31
http://tv.yahoo.com/tvpdb?d=tvs&id=166031546&channels=us_TBS&lineup=us_IL12561&.intl=us TBS 32
http://tv.yahoo.com/tvpdb?d=tvs&id=166030951&channels=us_DSC&lineup=us_IL12561&.intl=us DSC 33
http://tv.yahoo.com/tvpdb?d=tvs&id=166030306&channels=us_AMC&lineup=us_IL12561&.intl=us AMC 34
http://tv.yahoo.com/tvpdb?d=tvs&id=166030960&channels=us_TWC&lineup=us_IL12561&.intl=us TWC 35
http://tv.yahoo.com/tvpdb?d=tvs&id=166030348&channels=us_CNNH&lineup=us_IL12561&.intl=us CNNH 36
http://tv.yahoo.com/tvpdb?d=tvs&id=166030347&channels=us_CNN&lineup=us_IL12561&.intl=us CNN 37
http://tv.yahoo.com/tvpdb?d=tvs&id=166139705&channels=us_CSNCH&lineup=us_IL12561&.intl=us CSNCH 37
http://tv.yahoo.com/tvpdb?d=tvs&id=166031708&channels=us_TOON&lineup=us_IL12561&.intl=us TOON 38
http://tv.yahoo.com/tvpdb?d=tvs&id=166045202&channels=us_HALMRK&lineup=us_IL12561&.intl=us HALMRK 39
http://tv.yahoo.com/tvpdb?d=tvs&id=166030929&channels=us_FSCH&lineup=us_IL12561&.intl=us FSCH 40
http://tv.yahoo.com/tvpdb?d=tvs&id=166030359&channels=us_ESPN&lineup=us_IL12561&.intl=us ESPN 41
http://tv.yahoo.com/tvpdb?d=tvs&id=166031784&channels=us_ESPN2&lineup=us_IL12561&.intl=us ESPN2 42
http://tv.yahoo.com/tvpdb?d=tvs&id=166101002&channels=us_SPIKETV&lineup=us_IL12561&.intl=us SPIKETV 43
http://tv.yahoo.com/tvpdb?d=tvs&id=166030345&channels=us_CMTV&lineup=us_IL12561&.intl=us CMTV 44
http://tv.yahoo.com/tvpdb?d=tvs&id=166030925&channels=us_QVC&lineup=us_IL12561&.intl=us QVC 44
http://tv.yahoo.com/tvpdb?d=tvs&id=166030899&channels=us_MTV&lineup=us_IL12561&.intl=us MTV 45
http://tv.yahoo.com/tvpdb?d=tvs&id=166030309&channels=us_BET&lineup=us_IL12561&.intl=us BET 46
http://tv.yahoo.com/tvpdb?d=tvs&id=166030356&channels=us_DISN&lineup=us_IL12561&.intl=us DISN 47
http://tv.yahoo.com/tvpdb?d=tvs&id=166030908&channels=us_NIK&lineup=us_IL12561&.intl=us NIK 48
http://tv.yahoo.com/tvpdb?d=tvs&id=166030953&channels=us_TLC&lineup=us_IL12561&.intl=us TLC 49
http://tv.yahoo.com/tvpdb?d=tvs&id=166030307&channels=us_ARTS&lineup=us_IL12561&.intl=us A&E 50
http://tv.yahoo.com/tvpdb?d=tvs&id=166030961&channels=us_USA&lineup=us_IL12561&.intl=us USA 51
http://tv.yahoo.com/tvpdb?d=tvs&id=166030956&channels=us_TNT&lineup=us_IL12561&.intl=us TNT 52
http://tv.yahoo.com/tvpdb?d=tvs&id=166030889&channels=us_LIFE&lineup=us_IL12561&.intl=us LIFE 53
http://tv.yahoo.com/tvpdb?d=tvs&id=166031723&channels=us_CLTV&lineup=us_IL12561&.intl=us CLTV 53
http://tv.yahoo.com/tvpdb?d=tvs&id=166032298&channels=us_FNC&lineup=us_IL12561&.intl=us FNC 54
http://tv.yahoo.com/tvpdb?d=tvs&id=166030347&channels=us_CNN&lineup=us_IL12561&.intl=us CNN 55
http://tv.yahoo.com/tvpdb?d=tvs&id=166030353&channels=us_CSPAN&lineup=us_IL12561&.intl=us CSPAN 57
http://tv.yahoo.com/tvpdb?d=tvs&id=166030361&channels=us_EWTN&lineup=us_IL12561&.intl=us EWTN 58
http://tv.yahoo.com/tvpdb?d=tvs&id=166030352&channels=us_COURT&lineup=us_IL12561&.intl=us COURT 58
http://tv.yahoo.com/tvpdb?d=tvs&id=166030965&channels=us_VH1&lineup=us_IL12561&.intl=us VH1 59
http://tv.yahoo.com/tvpdb?d=tvs&id=166030901&channels=us_ETV&lineup=us_IL12561&.intl=us ETV 60
http://tv.yahoo.com/tvpdb?d=tvs&id=166031912&channels=us_TBN&lineup=us_IL12561&.intl=us TBN 61
http://tv.yahoo.com/tvpdb?d=tvs&id=166030965&channels=us_VH1&lineup=us_IL12561&.intl=us VH1 61
http://tv.yahoo.com/tvpdb?d=tvs&id=166031828&channels=us_FOOD&lineup=us_IL12561&.intl=us FOOD 61
http://tv.yahoo.com/tvpdb?d=tvs&id=166030958&channels=us_TRAV&lineup=us_IL12561&.intl=us TRAV 62
http://tv.yahoo.com/tvpdb?d=tvs&id=166033196&channels=us_OXYGEN&lineup=us_IL12561&.intl=us OXYGEN 63
http://tv.yahoo.com/tvpdb?d=tvs&id=166032240&channels=us_TVLAND&lineup=us_IL12561&.intl=us TVLAND 64
http://tv.yahoo.com/tvpdb?d=tvs&id=166032274&channels=us_MSNBC&lineup=us_IL12561&.intl=us MSNBC 65
http://tv.yahoo.com/tvpdb?d=tvs&id=166041102&channels=us_SHOPNBC&lineup=us_IL12561&.intl=us SHOPNBC 67
http://tv.yahoo.com/tvpdb?d=tvs&id=166032284&channels=us_ANIMAL&lineup=us_IL12561&.intl=us ANIMAL 68
http://tv.yahoo.com/tvpdb?d=tvs&id=166030889&channels=us_LIFE&lineup=us_IL12561&.intl=us LIFE 69
http://tv.yahoo.com/tvpdb?d=tvs&id=166032345&channels=us_CMP&lineup=us_IL12561&.intl=us CMP 71
http://tv.yahoo.com/tvpdb?d=tvs&id=166030368&channels=us_GALA&lineup=us_IL12561&.intl=us GALA 72
http://tv.yahoo.com/tvpdb?d=tvs&id=166030310&channels=us_BRAVO&lineup=us_IL12561&.intl=us BRAVO 73
http://tv.yahoo.com/tvpdb?d=tvs&id=166031913&channels=us_HISTORY&lineup=us_IL12561&.intl=us HISTORY 74
http://tv.yahoo.com/tvpdb?d=tvs&id=166031061&channels=us_TLNCHIC&lineup=us_IL12561&.intl=us TLNCHIC 75
http://tv.yahoo.com/tvpdb?d=tvs&id=166032215&channels=us_OLN&lineup=us_IL12561&.intl=us OLN 76
http://tv.yahoo.com/tvpdb?d=tvs&id=166030354&channels=us_CSPAN2&lineup=us_IL12561&.intl=us CSPAN2 77
http://tv.yahoo.com/tvpdb?d=tvs&id=166030353&channels=us_CSPAN&lineup=us_IL12561&.intl=us CSPAN 95
http://tv.yahoo.com/tvpdb?d=tvs&id=166030361&channels=us_EWTN&lineup=us_IL12561&.intl=us EWTN 96
http://tv.yahoo.com/tvpdb?d=tvs&id=166032367&channels=us_TVGOS&lineup=us_IL12561&.intl=us TVGOS 99
EOF
my @channels = map {[split ' ', $_, 3]} split /[\n\r]/, $channels;
my @yahoo_lineups; # [$channel][$ctr][$url_or_callsign]
foreach (split /[\n\r]/, $yahoo_lineups) {
next unless /\S/;
my $entry = [split ' '];
my $channel = $entry->[-1];
push(@{$yahoo_lineups[$channel]}, $entry);
}
#use Data::Dumper; die Dumper \@yahoo_lineups;
print <<'EOF';
Comcast (Gurnee/Waukegan, IL)
EOF
my $white_green = 0;
my @display_channels = grep {$_->[0] !~ /^#/} @channels;
foreach (my $ctr=0; $ctr<@display_channels; $ctr++) {
my @c = @{$display_channels[$ctr]};
$c[2] ||= '';
(my $symbol = $c[1]) =~ s/^-//;
$c[1] =~ s/^-.*//;
my ($anch, $afteranch) = ('', '');
if (my $href = $callsigns{$symbol}) {
$anch = "";
$afteranch = "";
}
if ($ctr && $ctr % int(0.99999 + @display_channels / 4) == 0) {
print " \n | \n";
$white_green = 0;
}
#my $gw = ($ctr & 0x01) ? "white" : "green";
my $gw = $white_green ? "white" : "green";
$white_green = !$white_green;
my $channel = $c[0];
my $channelurl = '';
if (@{$yahoo_lineups[$channel]} == 1) {
$channelurl = $yahoo_lineups[$channel][0][0];
} else {
foreach my $lnup (@{$yahoo_lineups[$channel]}) {
if ($lnup->[1] eq $symbol) {
$channelurl = $lnup->[0];
last;
}
}
}
$channel = "$c[0]" if ($channelurl);
if ($c[1]) {
$c[2] .= " " if ($c[2]);
#print "$c[0] | $c[2] | $anch$c[1]$afteranch\n";
print " | $channel | $c[2]\[$anch$c[1]$afteranch]\n";
} else {
print " | $channel | $anch$c[2]$afteranch\n";
}
}
| |