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 97486ff..422b802 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);