X-Git-Url: https://git.cweiske.de/stouyapi.git/blobdiff_plain/401f1919cfe020f5335a5c89a47c85694ca5188d..844c54b0c323cb1cbbe0f5b0d5ec8724be49eed4:/bin/import-game-data.php diff --git a/bin/import-game-data.php b/bin/import-game-data.php index 283c06b..e90ccc9 100755 --- a/bin/import-game-data.php +++ b/bin/import-game-data.php @@ -7,6 +7,7 @@ * @author Christian Weiske */ 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'); @@ -419,7 +420,7 @@ function buildDetails($game) $mediaTiles[] = [ 'type' => 'image', 'urls' => [ - 'thumbnail' => $medium->thumb, + 'thumbnail' => $medium->thumb ?? $medium->url, 'full' => $medium->url, ], ]; @@ -448,6 +449,13 @@ function buildDetails($game) $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', @@ -506,6 +514,11 @@ function buildDetails($game) 'promotedProduct' => $product, 'buttons' => $buttons, + + 'stouyapi' => [ + 'internet-archive' => $iaUrl, + 'developer-url' => $game->developer->website ?? null, + ] ]; } @@ -698,11 +711,6 @@ function buildDiscoverGameTile($game) ]; } -function categoryPath($title) -{ - return str_replace(['/', '\\', ' ', '+', '?'], '_', $title); -} - function getAllAges($games) { $ages = [];