Hide vimeo videos since they cause ssl errors v1.0.0
authorChristian Weiske <cweiske@cweiske.de>
Wed, 5 Feb 2020 19:59:23 +0000 (20:59 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 5 Feb 2020 19:59:23 +0000 (20:59 +0100)
bin/import-game-data.php

index 97486ff201ff2a90573fdced45d41329236a7aa6..422b8025c08a3716bf9b589d407d49ed11bb7e08 100755 (executable)
@@ -419,10 +419,12 @@ function buildDetails($game)
                 ],
             ];
         } else {
-            $mediaTiles[] = [
-                'type' => 'video',
-                'url'  => $medium->url,
-            ];
+            if (!isUnsupportedVideoUrl($medium->url)) {
+                $mediaTiles[] = [
+                    'type' => 'video',
+                    'url'  => $medium->url,
+                ];
+            }
         }
     }
 
@@ -852,6 +854,16 @@ function getPromotedProduct($game)
     return null;
 }
 
+/**
+ * vimeo only work with HTTPS now,
+ * and the OUYA does not support SNI.
+ * We get SSL errors and no video for them :/
+ */
+function isUnsupportedVideoUrl($url)
+{
+    return strpos($url, '://vimeo.com/') !== false;
+}
+
 function removeMakeGames(array $games)
 {
     return filterByGenre($games, 'Tutorials', true);