Files
wizzardRedux/sites/C64Tapes.php

83 lines
1.7 KiB
PHP
Raw Normal View History

<?php
// Original code: The Wizard of DATz
$page = "http://c64tapes.org/games_list.php?title=^.&sort=title";
2016-03-13 17:39:42 -07:00
echo "<table>\n";
$content = get_data($page);
2016-03-13 17:39:42 -07:00
preg_match_all("/<tr>(.*?TAP icon.*?)<\/tr>/", utf8_decode($content), $query);
$query = $query[1];
unset($query[0]);
$new = 0;
$old = 0;
2016-03-13 17:39:42 -07:00
foreach ($query as $row)
{
2016-03-13 17:39:42 -07:00
preg_match_all("/<td.*?>(.*?)<\/td>/", $row, $row);
$row = $row[1];
$id = $row[0];
$name = str_replace(array('[', ']'), array('(', ')'), $row[1]);
$name = trim(strip_tags($name));
$add = str_replace(array('<a class="year" href="year.php?id=1">[unkn]</a>',
' (', ')', '</a>', '<a', '[', ']'),
array(null, ', ', null, ')</a>', '(<a', null, null), $row[3]);
$add = trim(strip_tags($add));
$dl_page = get_data("http://c64tapes.org/title.php?id=".$id);
preg_match("/<td>Filename \(TAP\): <\/td>(.*?)<\/td>/", utf8_decode($dl_page), $url1);
$url1 = strip_tags($url1[1]);
preg_match("/<td>Filename \(RAW\): <\/td>(.*?)<\/td>/", utf8_decode($dl_page), $url2);
$url2 = strip_tags($url2[1]);
if ($url1 != "")
{
2016-03-13 17:39:42 -07:00
$id = 'taps/'.$url1;
if (!$r_query[$id])
{
2016-03-13 17:39:42 -07:00
echo "<tr><td colspan=2>".$name.' '.$add."</td></tr>";
$found[] = array($name.' '.$add.".zip", "http://c64tapes.org/".$id);
$new++;
}
else
{
$old++;
}
}
2016-03-13 17:39:42 -07:00
if ($url2 != "")
{
$id = 'raw/'.$url2;
if (!$r_query[$id])
{
echo "<tr><td colspan=2>".$name.' '.$add."</td></tr>";
$found[] = array($name.' '.$add.".zip", "http://c64tapes.org/".$id);
$new++;
}
else
{
$old++;
}
}
}
2016-03-13 17:39:42 -07:00
echo "<tr><td>".$page."</td><td>Found new: ".$new.", old: ".$old."</tr>\n</table>\n";
2016-03-13 17:39:42 -07:00
if (sizeof($found) > 0)
{
2016-03-13 17:39:42 -07:00
echo "<h2>New files:</h2>";
}
foreach ($found as $row)
{
2016-03-13 17:39:42 -07:00
echo "<a href='".$row[1]."'>".$row[0]."</a><br/>\n";
}
2016-03-13 17:39:42 -07:00
echo "<br/>\n";
?>