git.cweiske.de
/
stouyapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Deduplicate developer products
[stouyapi.git]
/
bin
/
import-game-data.php
diff --git
a/bin/import-game-data.php
b/bin/import-game-data.php
index 14996c4635a71e5ebb27f6544722f1db404d3c68..182708a050e0337f3f3c5c06b4117efa7430ddbd 100755
(executable)
--- a/
bin/import-game-data.php
+++ b/
bin/import-game-data.php
@@
-7,6
+7,7
@@
* @author Christian Weiske <cweiske@cweiske.de>
*/
ini_set('xdebug.halt_level', E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
* @author Christian Weiske <cweiske@cweiske.de>
*/
ini_set('xdebug.halt_level', E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
+require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/filters.php';
if (!isset($argv[1])) {
error('Pass the path to a "folders" file with game data json files folder names');
require_once __DIR__ . '/filters.php';
if (!isset($argv[1])) {
error('Pass the path to a "folders" file with game data json files folder names');
@@
-448,6
+449,13
@@
function buildDetails($game)
$product = buildProduct($gamePromoted);
}
$product = buildProduct($gamePromoted);
}
+ $iaUrl = null;
+ if (isset($game->latestRelease->url)
+ && substr($game->latestRelease->url, 0, 29) == 'https://archive.org/download/'
+ ) {
+ $iaUrl = dirname($game->latestRelease->url) . '/';
+ }
+
// http://cweiske.de/ouya-store-api-docs.htm#get-https-devs-ouya-tv-api-v1-details
return [
'type' => 'Game',
// http://cweiske.de/ouya-store-api-docs.htm#get-https-devs-ouya-tv-api-v1-details
return [
'type' => 'Game',
@@
-506,6
+514,11
@@
function buildDetails($game)
'promotedProduct' => $product,
'buttons' => $buttons,
'promotedProduct' => $product,
'buttons' => $buttons,
+
+ 'stouyapi' => [
+ 'internet-archive' => $iaUrl,
+ 'developer-url' => $game->developer->website ?? null,
+ ]
];
}
];
}
@@
-538,6
+551,9
@@
function buildDeveloperProductOnly($product, $developer)
*/
function buildDeveloperProducts($products, $developer)
{
*/
function buildDeveloperProducts($products, $developer)
{
+ //remove duplicates
+ $products = array_values(array_column($products, null, 'identifier'));
+
$jsonProducts = [];
foreach ($products as $product) {
$jsonProducts[] = buildProduct($product);
$jsonProducts = [];
foreach ($products as $product) {
$jsonProducts[] = buildProduct($product);
@@
-698,11
+714,6
@@
function buildDiscoverGameTile($game)
];
}
];
}
-function categoryPath($title)
-{
- return str_replace(['/', '\\', ' ', '+', '?'], '_', $title);
-}
-
function getAllAges($games)
{
$ages = [];
function getAllAges($games)
{
$ages = [];