From: Christian Weiske Date: Sun, 18 Jul 2021 18:46:15 +0000 (+0200) Subject: Add "best rated games" category X-Git-Tag: v3.0.0~5 X-Git-Url: https://git.cweiske.de/stouyapi.git/commitdiff_plain/d33aeec287423662ca1e63252d6b63f550d37e83 Add "best rated games" category --- diff --git a/bin/filters.php b/bin/filters.php index 9cac07a..f899be0 100644 --- a/bin/filters.php +++ b/bin/filters.php @@ -117,6 +117,14 @@ function filterBestRated($origGames, $limit) return array_slice($games, 0, $limit); } +function filterBestRatedGames($origGames, $limit) +{ + $noApps = filterByGenre($origGames, 'App', true); + $noAppsNoEmus = filterByGenre($noApps, 'Emulator', true); + + return filterBestRated($noAppsNoEmus, $limit); +} + function filterMostDownloaded($origGames, $limit) { $games = array_values($origGames); diff --git a/bin/import-game-data.php b/bin/import-game-data.php index d98dd3f..2685b3f 100755 --- a/bin/import-game-data.php +++ b/bin/import-game-data.php @@ -175,8 +175,8 @@ function buildDiscover(array $games) filterLastAdded($games, 10) ); addDiscoverRow( - $data, 'Best rated', - filterBestRated($games, 10), + $data, 'Best rated games', + filterBestRatedGames($games, 10), true ); @@ -191,6 +191,7 @@ function buildDiscover(array $games) $data, 'Special', [ 'Best rated', + 'Best rated games', 'Most rated', 'Random', 'Last updated', @@ -200,6 +201,10 @@ function buildDiscover(array $games) 'api/v1/discover-data/' . categoryPath('Best rated') . '.json', buildSpecialCategory('Best rated', filterBestRated($games, 99)) ); + writeJson( + 'api/v1/discover-data/' . categoryPath('Best rated games') . '.json', + buildSpecialCategory('Best rated games', filterBestRatedGames($games, 99)) + ); writeJson( 'api/v1/discover-data/' . categoryPath('Most rated') . '.json', buildSpecialCategory('Most rated', filterMostDownloaded($games, 99))