Move "cweiskes picks" to configuration file
authorChristian Weiske <cweiske@cweiske.de>
Thu, 30 Apr 2020 14:15:56 +0000 (16:15 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 30 Apr 2020 14:16:26 +0000 (16:16 +0200)
.gitignore
bin/import-game-data.php
config.php.dist [new file with mode: 0644]

index 0f58418bd681a189cb9de418a2e21932b8d56185..a383eb431a15a6d6a8b2e9bd6a2d0289de35b50a 100644 (file)
@@ -1,3 +1,4 @@
+/config.php
 /README.html
 www/api/v1/apps/
 www/api/v1/details-data/
index 422b8025c08a3716bf9b589d407d49ed11bb7e08..9dc05106bb6df5ede8f45fbf449e01ac125f89b7 100755 (executable)
@@ -16,11 +16,12 @@ if (!is_file($foldersFile)) {
     error('Given path is not a file: ' . $foldersFile);
 }
 
-$GLOBALS['packagelists']['cweiskepicks'] = [
-    'de.eiswuxe.blookid2',
-    'com.cosmos.babyloniantwins',
-    'com.inverseblue.skyriders',
-];
+//default configuration values
+$GLOBALS['packagelists'] = [];
+$cfgFile = __DIR__ . '/../config.php';
+if (file_exists($cfgFile)) {
+    include $cfgFile;
+}
 
 $wwwDir = __DIR__ . '/../www/';
 
@@ -152,10 +153,13 @@ function buildDiscover(array $games)
         $data, 'Best rated',
         filterBestRated($games, 10)
     );
-    addDiscoverRow(
-        $data, "cweiske's picks",
-        filterByPackageNames($games, $GLOBALS['packagelists']['cweiskepicks'])
-    );
+
+    foreach ($GLOBALS['packagelists'] as $listTitle => $listPackageNames) {
+        addDiscoverRow(
+            $data, $listTitle,
+            filterByPackageNames($games, $listPackageNames)
+        );
+    }
 
     addDiscoverRow(
         $data, 'Special',
diff --git a/config.php.dist b/config.php.dist
new file mode 100644 (file)
index 0000000..11c34a2
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+/**
+ * Optional configuration file for import-game-data.php
+ * Copy it to config.php and adjust it.
+ */
+$GLOBALS['packagelists']["cweiske's picks"] = [
+    'de.eiswuxe.blookid2',
+    'com.cosmos.babyloniantwins',
+    'com.inverseblue.skyriders',
+];