| 1318 | | "ACT" => 126, |
| 1319 | | "NSW: Sydney" => 73, |
| 1320 | | "NSW: Newcastle" => 184, |
| 1321 | | "NSW: Central Coast" => 66, |
| 1322 | | "NSW: Griffith" => 67, |
| 1323 | | "NSW: Broken Hill" => 63, |
| 1324 | | "NSW: Northern NSW" => 69, |
| 1325 | | "NSW: Southern NSW" => 71, |
| 1326 | | "NSW: Remote and Central" => 106, |
| 1327 | | "NT: Darwin" => 74, |
| 1328 | | "NT: Remote & Central" => 108, |
| 1329 | | "QLD: Brisbane" => 75, |
| 1330 | | "QLD: Gold Coast" => 78, |
| 1331 | | "QLD: Regional" => 79, |
| 1332 | | "QLD: Remote & Central" => 114, |
| 1333 | | "SA: Adelaide" => 81, |
| 1334 | | "SA: Renmark" => 82, |
| 1335 | | "SA: Riverland" => 83, |
| 1336 | | "SA: South East SA" => 85, |
| 1337 | | "SA: Spencer Gulf" => 86, |
| 1338 | | "SA: Remote & Central" => 107, |
| 1339 | | "Tasmania" => 88, |
| 1340 | | "VIC: Melbourne" => 94, |
| 1341 | | "VIC: Geelong" => 93, |
| 1342 | | "VIC: Eastern Victoria" => 90, |
| 1343 | | "VIC: Mildura/Sunraysia" => 95, |
| 1344 | | "VIC: Western Victoria" => 98, |
| 1345 | | "WA: Perth" => 101, |
| 1346 | | "WA: Regional" => 102 |
| | 1318 | 126 => "ACT", |
| | 1319 | 73 => "NSW: Sydney", |
| | 1320 | 184 => "NSW: Newcastle", |
| | 1321 | 66 => "NSW: Central Coast", |
| | 1322 | 67 => "NSW: Griffith", |
| | 1323 | 63 => "NSW: Broken Hill", |
| | 1324 | 69 => "NSW: Northern NSW", |
| | 1325 | 71 => "NSW: Southern NSW", |
| | 1326 | 106 => "NSW: Remote and Central", |
| | 1327 | 74 => "NT: Darwin", |
| | 1328 | 108 => "NT: Remote & Central", |
| | 1329 | 75 => "QLD: Brisbane", |
| | 1330 | 78 => "QLD: Gold Coast", |
| | 1331 | 79 => "QLD: Regional", |
| | 1332 | 114 => "QLD: Remote & Central", |
| | 1333 | 81 => "SA: Adelaide", |
| | 1334 | 82 => "SA: Renmark", |
| | 1335 | 83 => "SA: Riverland", |
| | 1336 | 85 => "SA: South East SA", |
| | 1337 | 86 => "SA: Spencer Gulf", |
| | 1338 | 107 => "SA: Remote & Central", |
| | 1339 | 88 => "Tasmania", |
| | 1340 | 94 => "VIC: Melbourne", |
| | 1341 | 93 => "VIC: Geelong", |
| | 1342 | 90 => "VIC: Eastern Victoria", |
| | 1343 | 95 => "VIC: Mildura/Sunraysia", |
| | 1344 | 98 => "VIC: Western Victoria", |
| | 1345 | 101 => "WA: Perth", |
| | 1346 | 102 => "WA: Regional" |
| 1351 | | foreach (sort keys %$REGIONS) |
| 1352 | | { |
| 1353 | | printf(" (%3d) %s\n", $REGIONS->{$_}, $_); |
| 1354 | | } |
| 1355 | | $region = ask_choice("Enter region code:", "94", values %$REGIONS); |
| | 1351 | foreach (sort { $REGIONS->{$a} cmp $REGIONS->{$b} } keys %$REGIONS) |
| | 1352 | { |
| | 1353 | printf(" (%3d) %s\n", $_, $REGIONS->{$_}); |
| | 1354 | } |
| | 1355 | $region = ask_choice("Enter region code:", "94", keys %$REGIONS); |
| | 1473 | } |
| | 1474 | return @channellist; |
| | 1475 | } |
| | 1476 | |
| | 1477 | # Sourced from YourTV |
| | 1478 | sub get_channels |
| | 1479 | { |
| | 1480 | my $regionname = shift; |
| | 1481 | |
| | 1482 | # Download list |
| | 1483 | my $ua = LWP::UserAgent->new(); |
| | 1484 | $ua->agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322'); |
| | 1485 | $ua->cookie_jar({}); |
| | 1486 | $ua->get('http://www.yourtv.com.au'); |
| | 1487 | my $response = $ua->get('http://www.yourtv.com.au/profile/ajax.cfm?action=channels®ion_id='.$region); |
| | 1488 | |
| | 1489 | my $page = $response->content; |
| | 1490 | die "Unable to download channel list" if ($response->is_error()); |
| | 1491 | |
| | 1492 | # Rules for Station Names: |
| | 1493 | # Station names are comprised of the channel name (eg "Seven") and an |
| | 1494 | # optional regional qualifier in brackets (eg "(Cairns/Rockhampton)"). |
| | 1495 | # Station names shall not contain a regional qualifer unless |
| | 1496 | # necessary to distinguish between identical channel names in |
| | 1497 | # the same region; in this case, a regional qualifier shall always |
| | 1498 | # be included. In the absence of anything better, the region name |
| | 1499 | # (eg "NSW: Regional NSW") is used as the regional qualifier. |
| | 1500 | my (@channellist, $clist, $cn, $rq); |
| | 1501 | while ($page =~ /<label for="venue_id.*?>(.*?)<\/label>/sg) |
| | 1502 | { |
| | 1503 | my $channel = $1; |
| | 1504 | $channel =~ s/\s{2,}//g; |
| | 1505 | if ($channel =~ /(.*) (\(.*\))/) |
| | 1506 | { |
| | 1507 | ($cn, $rq) = ($1, $2); |
| | 1508 | } |
| | 1509 | else |
| | 1510 | { |
| | 1511 | $cn = $channel; |
| | 1512 | $rq = ''; |
| | 1513 | } |
| | 1514 | # Is there already a channel with this name? |
| | 1515 | if ($clist->{$cn}) |
| | 1516 | { |
| | 1517 | # Set regional qualifier for existing station if not already set |
| | 1518 | if (@{$clist->{$cn}} == 1 and $clist->{$cn}[0] eq '') |
| | 1519 | { |
| | 1520 | $clist->{$cn} = [ "($regionname)" ]; |
| | 1521 | } |
| | 1522 | $rq = $regionname if ($rq eq ''); |
| | 1523 | die "Bad channel list in region $region!" if (grep($rq eq $_, @{$clist->{$cn}})); |
| | 1524 | push @{$clist->{$cn}}, $rq; |
| | 1525 | } |
| | 1526 | else |
| | 1527 | { |
| | 1528 | $clist->{$cn} = [ $rq ]; |
| | 1529 | } |
| | 1530 | } |
| | 1531 | foreach $cn (keys %$clist) |
| | 1532 | { |
| | 1533 | if (@{$clist->{$cn}} == 1) |
| | 1534 | { |
| | 1535 | push @channellist, $cn; |
| | 1536 | } |
| | 1537 | else |
| | 1538 | { |
| | 1539 | foreach $rq (@{$clist->{$cn}}) |
| | 1540 | { |
| | 1541 | push @channellist, "$cn $rq"; |
| | 1542 | } |
| | 1543 | } |