Link game pages to internet archive
authorChristian Weiske <cweiske@cweiske.de>
Wed, 27 May 2020 20:14:35 +0000 (22:14 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 27 May 2020 20:14:35 +0000 (22:14 +0200)
bin/build-html.php
bin/import-game-data.php
data/templates/game.tpl.php

index 3f6fa4b42423a9e105029c3af782e2ad7ea97196..18e25e53bb95b2a413bf87110cb20a32653362be 100755 (executable)
@@ -159,7 +159,16 @@ function renderGameFile($gameDataFile)
             $appsDir . $json->version->uuid . '-download.json'
         )
     );
             $appsDir . $json->version->uuid . '-download.json'
         )
     );
+
     $apkDownloadUrl = $downloadJson->app->downloadLink;
     $apkDownloadUrl = $downloadJson->app->downloadLink;
+    /*
+    if (isset($json->premium) && $json->premium) {
+        $apkDownloadUrl = null;
+    }
+    */
+
+    $internetArchiveUrl = $json->stouyapi->{'internet-archive'} ?? null;
+
     $pushUrl = $GLOBALS['pushToMyOuyaUrl']
         . '?game=' . urlencode($json->apk->package);
 
     $pushUrl = $GLOBALS['pushToMyOuyaUrl']
         . '?game=' . urlencode($json->apk->package);
 
index 11ed6b38993ba0e3297cad953ffba1bee7d690d3..cfd16308e5eba6f93d3fbc634c39600d5d525271 100755 (executable)
@@ -449,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',
@@ -507,6 +514,10 @@ function buildDetails($game)
 
         'promotedProduct' => $product,
         'buttons'         => $buttons,
 
         'promotedProduct' => $product,
         'buttons'         => $buttons,
+
+        'stouyapi' => [
+            'internet-archive' => $iaUrl,
+        ]
     ];
 }
 
     ];
 }
 
index 60f93266dececd292741e764493214e7d1f81851..ce9c5613f46529bbb5ce5ccae6078b91e3e27f18 100644 (file)
@@ -68,6 +68,7 @@
 
   <section class="buttons">
    <h2>Links</h2>
 
   <section class="buttons">
    <h2>Links</h2>
+   <?php if ($apkDownloadUrl): ?>
    <div>
     <a href="<?= $apkDownloadUrl ?>">Download .apk</a>
     <p>
    <div>
     <a href="<?= $apkDownloadUrl ?>">Download .apk</a>
     <p>
      <?= gmdate('Y-m-d', $json->version->publishedAt) ?>
     </p>
    </div>
      <?= gmdate('Y-m-d', $json->version->publishedAt) ?>
     </p>
    </div>
+   <?php endif ?>
+   <?php if ($internetArchiveUrl): ?>
+   <div>
+    <a href="<?= $internetArchiveUrl ?>">Internet Archive page</a>
+   </div>
+   <?php endif ?>
    <div>
     <form method="post" action="<?= htmlspecialchars($pushUrl) ?>" id="push" onsubmit="pushToMyOuya();return false;">
      <button name="push" type="submit" class="push-to-my-ouya">
    <div>
     <form method="post" action="<?= htmlspecialchars($pushUrl) ?>" id="push" onsubmit="pushToMyOuya();return false;">
      <button name="push" type="submit" class="push-to-my-ouya">