add support for linking original and unlocked versions
authorChristian Weiske <cweiske@cweiske.de>
Fri, 29 Nov 2019 21:41:08 +0000 (22:41 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 29 Nov 2019 21:41:08 +0000 (22:41 +0100)
bin/import-game-data.php

index 75841b66b5be29c20979f7b2a013e39300e72e20..bb3fef86921a60c64cfaf91dbc993e06203ced6c 100755 (executable)
@@ -298,6 +298,15 @@ function buildDetails($game)
         }
     }
 
         }
     }
 
+    $buttons = [];
+    if (isset($game->links->unlocked)) {
+        $buttons[] = [
+            'text' => 'Show unlocked',
+            'url'  => 'ouya://launcher/details?app=' . $game->links->unlocked,
+            'bold' => true,
+        ];
+    }
+
     // 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',
@@ -355,6 +364,7 @@ function buildDetails($game)
         ],
 
         'promotedProduct' => null,
         ],
 
         'promotedProduct' => null,
+        'buttons'         => $buttons,
     ];
 }
 
     ];
 }
 
@@ -387,6 +397,11 @@ function addDiscoverRow(&$data, $title, $games)
 
         } else {
             //game
 
         } else {
             //game
+            if (isset($game->links->original)) {
+                //do not link unlocked games.
+                // people an access them via the original games
+                continue;
+            }
             $tilePos = findTile($data['tiles'], $game->packageName);
             if ($tilePos === null) {
                 $tilePos = count($data['tiles']);
             $tilePos = findTile($data['tiles'], $game->packageName);
             if ($tilePos === null) {
                 $tilePos = count($data['tiles']);