aboutsummaryrefslogtreecommitdiff
path: root/generate-gallery.py
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-03-14 11:19:09 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2026-03-14 11:19:09 +0100
commit3cc7196d40d34be8f994bd37b8bf7a7ac6902b7f (patch)
treec7ed8b91882687af618a2373cbf4d7e2b4089959 /generate-gallery.py
parentcf6508f2eed048012ed6f645c0cd1e39f766d497 (diff)
downloadscratch-gallery-3cc7196d40d34be8f994bd37b8bf7a7ac6902b7f.tar.gz
scratch-gallery-3cc7196d40d34be8f994bd37b8bf7a7ac6902b7f.zip
allow to build a publishable gallery
This includes only projects that are explicitly allowed to be published.
Diffstat (limited to 'generate-gallery.py')
-rwxr-xr-xgenerate-gallery.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/generate-gallery.py b/generate-gallery.py
index 4daacad..375adbd 100755
--- a/generate-gallery.py
+++ b/generate-gallery.py
@@ -44,7 +44,7 @@ def nested_set(data_dict, key_sequence, value):
data_dict[key_sequence[-1]] = value
-def load_projects(root: str) -> dict:
+def load_projects(root: str, publishable=False) -> dict:
"""Load all game meta data from the games directory"""
projects = {}
@@ -61,6 +61,10 @@ def load_projects(root: str) -> dict:
with open(parent / 'meta.toml', 'rb') as meta_file:
game = tomllib.load(meta_file)
+
+ if publishable and not game.get('oeffentlich', False):
+ continue
+
if 'Name' not in game:
if 'Datei' in game:
game['Name'] = pathlib.Path(game['Datei']).stem
@@ -144,6 +148,7 @@ def main():
parser.add_argument('--author', default='Florian Fischer', help='author mentioned in the HTML')
parser.add_argument('--title', default='Scratch Galerie', help='title of the web page')
parser.add_argument('--projects-dir', default='projects', help='location of the projects')
+ parser.add_argument('--publish', action='store_true', help='build a publishable gallery')
parser.add_argument('--no-packaging',
action='store_true',
help='do not package all encountered scratch projects')
@@ -154,7 +159,7 @@ def main():
env = Environment(loader=FileSystemLoader('templates'), autoescape=select_autoescape())
- projects = load_projects(args.projects_dir)
+ projects = load_projects(args.projects_dir, publishable=args.publish)
prepare_outputdir(args.output_dir, projects)