diff --git a/.gitignore b/.gitignore
index a505071..9857ee0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ thumbs/*
GenThumb.log
index*.html
.vscode
+gallery.html
diff --git a/GenGallery.py b/GenGallery.py
new file mode 100755
index 0000000..f24fa1e
--- /dev/null
+++ b/GenGallery.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+# GenThumb.py - Part of the simple s3 gallery
+# Usage: ./GenThumb.py
+
+from pathlib import Path
+import getopt
+import sys
+import os
+
+# Set these to override
+baseuri = os.environ.get('BASEURI',"https://s3.wasabisys.com/c0de-photography/")
+thumb_path = os.environ.get('THUMBNAILS', "./thumbs")
+
+# Load templates into memory
+gallery_template = open('templates/root_gallery.html', 'r').read()
+card_template = open('templates/card.html', 'r').read()
+
+# Get all the index files in local directory
+indexlist = list(Path(".").rglob("index_*.html"))
+
+with open('gallery.html', 'w') as gallery:
+ thumbrow = ""
+ for index in indexlist:
+ the_template = card_template # Don't mutate the source
+ # basic string replacements
+ the_template = the_template.replace("{{FULLLINK}}", index.name)
+ the_template = the_template.replace("{{TITLE}}", index.name.strip("index_").strip(".html").replace(":", "/"))
+ thumbrow += the_template.replace("{{THUMBNAIL}}", "thumbs/folder.png")
+ gallery.write(gallery_template.replace("{{THUMBROW}}", thumbrow))
+
diff --git a/GenTemplate.py b/GenTemplate.py
index 6586966..a3838e2 100755
--- a/GenTemplate.py
+++ b/GenTemplate.py
@@ -23,159 +23,12 @@ for opt, arg in opts:
elif opt in ("-p", "--pathlist"):
pathlist_file = arg # Index file created by GenThumb.py
-template = """
-
-
- Simple S3 Gallery
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
About
-
This is a small gallery to represent images that I have taken over the past few years. Most of these are unsorted and unedited, and thus a lot are blurry or have lighting issues. I have taken, and thereby own all photos on this site.
This is a small gallery to represent images that I have taken over the past few years. Most of these are unsorted and unedited, and thus a lot are blurry or have lighting issues. I have taken, and thereby own all photos on this site.