X-Git-Url: https://git.cweiske.de/stouyapi.git/blobdiff_plain/01698ecd0a45f26ce98ed2b88a39704a6f356339..9eac7d80597a883ba0960b14a051b1b63b7b08be:/bin/import-game-data.php diff --git a/bin/import-game-data.php b/bin/import-game-data.php index e5d62e9..cf6a047 100755 --- a/bin/import-game-data.php +++ b/bin/import-game-data.php @@ -124,6 +124,13 @@ foreach ($developers as $developer) { writeJson('api/v1/discover-data/discover.json', buildDiscover($games)); writeJson('api/v1/discover-data/home.json', buildDiscoverHome($games)); +//make +writeJson( + 'api/v1/discover-data/tutorials.json', + buildMakeCategory('Tutorials', filterByGenre($games, 'Tutorials')) +); + + function buildDiscover(array $games) { @@ -170,7 +177,7 @@ function buildDiscover(array $games) ); } - $genres = getAllGenres($games); + $genres = removeMakeGenres(getAllGenres($games)); sort($genres); addChunkedDiscoverRows($data, $genres, 'Genres'); @@ -226,6 +233,25 @@ function buildDiscoverCategory($name, $games) return $data; } +function buildMakeCategory($name, $games) +{ + $data = [ + 'title' => $name, + 'rows' => [], + 'tiles' => [], + ]; + + usort( + $games, + function ($gameA, $gameB) { + return strcasecmp($gameA->title, $gameB->title); + } + ); + addDiscoverRow($data, '', $games); + + return $data; +} + function buildDiscoverHome(array $games) { //we do not want anything here for now @@ -748,6 +774,17 @@ function getPromotedProduct($game) return null; } +function removeMakeGenres($genres) +{ + $filtered = []; + foreach ($genres as $genre) { + if ($genre != 'Tutorials' && $genre != 'Builds') { + $filtered[] = $genre; + } + } + return $filtered; +} + function writeJson($path, $data) { global $wwwDir;