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 0f58418..a383eb4 100644 (file)
@@ -1,3 +1,4 @@
+/config.php
 /README.html
 www/api/v1/apps/
 www/api/v1/details-data/
index 422b802..9dc0510 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',
+];