<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<link rel="stylesheet" href="/brushedmetal.css" />
<title>Electroblog.com: TV DX catch list (gallery coming soon)</title>
</head>
<body>
<div id="header">
<div id="headerlinks"><a href="/index.php">Blog</a> <a href="/laptop/index.shtml">Laptop disassembly</a> <a href="/radio/index.php">Radio stuff</a></div>
</div>
<div class="contentboxheader">
TV DX catch list (gallery coming soon)
</div>
<div class="contentbox">
<?php

$listpos = 0;
$data = fopen(stationdata, 'r');
$entry = explode("|", fgets($data));

$lat1 = 0.75039461554377;
$lon1 = -1.508968038043;

while (!feof($data)) {
 $lat = deg2rad(abs($entry[20]) + (abs($entry[21]) + abs($entry[22])/60)/60);
 $lon = deg2rad((abs($entry[24]) + (abs($entry[25]) + abs($entry[26])/60)/60) * -1);

 $dist = round(acos(cos($lat)*cos($lon)*cos($lat1)*cos($lon1) + cos($lat)*sin($lon)*cos($lat1)*sin($lon1) + sin($lat)*sin($lat1)) * 3959.8692226284, 2);
 $dataarray[$listpos] = array(trim($entry[1]), abs(trim($entry[4])), trim($entry[3]), trim($entry[10]), trim($entry[11]), $dist);
 $listpos++;
 $entry = explode("|", fgets($data));
}
fclose($data);
unset($entry, $listpos);

foreach ($dataarray as $listpos => $entry) {
 $channel[$listpos] = $entry[1];
}

array_multisort($channel, SORT_ASC, $dataarray);

foreach ($dataarray as $entry) {
 if (stristr($entry[2], "D")) { if (stristr($entry[0], "-TV")) { $dtname = str_replace("-TV", "-DT", $entry[0]); } else { $dtname = $entry[0]."-DT"; } }
 if (file_exists($entry[0].".jpg") && !stristr($entry[2], "D")) {
  echo "<a href=\"".$entry[0].".jpg\">".$entry[0]."</a> ".$entry[1]." (".$entry[2].") - ".$entry[3].", ".$entry[4]." - ".$entry[5]." miles<br />\n";
 } elseif (file_exists($dtname.".jpg") && stristr($entry[2], "D")) {
  echo "<a href=\"".$dtname.".jpg\">".$entry[0]."</a> ".$entry[1]." (".$entry[2].") - ".$entry[3].", ".$entry[4]." - ".$entry[5]." miles<br />\n";
 } else {
  echo $entry[0]." ".$entry[1]." (".$entry[2].") - ".$entry[3].", ".$entry[4]." - ".$entry[5]." miles<br />\n";
 }
}
?>
</div>
</body>
</html>
