3 * List games from the "push to my OUYA" list
5 * Pushes are stored in the sqlite3 database in push-to-my-ouya.php
7 * @author Christian Weiske <cweiske@cweiske.de>
9 $dbFile = __DIR__ . '/../../../data/push-to-my-ouya.sqlite3';
10 $apiGameDir = __DIR__ . '/details-data/';
12 require_once __DIR__ . '/../../../src/push-to-my-ouya-helpers.php';
14 $ip = $_SERVER['REMOTE_ADDR'];
15 if ($ip == '' || strpos($ip, ':') !== false) {
17 header('Content-type: application/json');
18 echo file_get_contents('queued_downloads');
24 $db = new SQLite3($dbFile, SQLITE3_OPEN_READONLY);
25 } catch (Exception $e) {
27 header('Content-type: application/json');
28 echo file_get_contents('queued_downloads');
33 'SELECT * FROM pushes'
34 . ' WHERE ip = \'' . SQLite3::escapeString($ip) . '\''
37 while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
38 $apiGameFile = $apiGameDir . $row['game'] . '.json';
39 if (!file_exists($apiGameFile)) {
43 $json = json_decode(file_get_contents($apiGameFile));
46 'title' => $json->title,
48 'uuid' => $row['game'],
52 header('Content-type: application/json');
53 echo json_encode(['queue' => $queue]) . "\n";