-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
71 lines (65 loc) · 1.86 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<title>pouët.net data dumps</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">table{border-collapse:collapse;float:left;margin-right:20px;}td,th{border:1px solid #ccc;padding:3px 10px;overflow:hidden;}th{background:#ccc}tr:hover{background:#eee}*{font-family:segoe ui,sans-serif;}label,input[type=submit]{display:block;}input[type=text]{width:300px;padding:3px 6px;}</style>
</head>
<body>
<h1>Fresh dumps of (part of) the Pouët.net database</h1>
<p>New dump every wednesday morning. Also available as <a href="json.php">a JSON feed</a>.</p>
<p>Looking for live data? Check our <a href='https://api.pouet.net/'>API</a>.</p>
<?php
$dirs = glob("dumps/*");
$a = array();
foreach($dirs as $dir)
{
$a = array_merge($a,glob($dir."/*"));
}
rsort($a);
$dates = array();
$tables = array();
$files = array();
foreach($a as $v)
{
preg_match("/pouetdatadump-(.*)-(.*).json/",$v,$m);
if (strstr($v,".inprogress")) continue;
$tables[$m[1]] = true;
$dates[$m[2]] = true;
$files[$m[1].$m[2]] = $v;
}
echo "<table>\n";
$lastYear = "";
foreach($dates as $date=>$_true)
{
$year = substr($date,0,4);
if ($year != $lastYear)
{
echo "<tr>\n";
echo " <th>".$year."</th>\n";
foreach($tables as $k=>$v)
echo " <th>".$k."</th>\n";
echo "</tr>\n";
$lastYear = $year;
}
echo "<tr>\n";
echo " <th>".$date."</th>\n";
foreach($tables as $table=>$_true2)
{
$filename = @$files[ $table . $date ]; // "pouetdatadump-".$k2."-".$k.".json.gz";
if ($filename && file_exists($filename))
{
$nfo = pathinfo($filename);
echo " <td><a href='".$filename."'>download .".$nfo["extension"]."</a> (".(int)(filesize($filename)/1024)."KB)</td>\n";
}
else
{
echo " <td> </td>\n";
}
}
echo "</tr>\n";
}
echo "</table>\n";
?>
</body>
</html>