diff options
Diffstat (limited to 'generate-gallery.py')
| -rwxr-xr-x | generate-gallery.py | 9 |
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) |
