simple_gallery

Generate simple, static HTML/CSS gallery
Log | Files | Refs | README

commit 936bba4e16017984909d40bed4770608375c20a5
parent 653246466fd76dd1f3dc515967fc03204e7e3f06
Author: sej <sej@sejdt.localhost>
Date:   Mon, 30 Sep 2024 17:38:42 +0200

Template cleanup + next/prev image fix.

Diffstat:
Mjinjarender.py | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/jinjarender.py b/jinjarender.py @@ -43,9 +43,9 @@ if __name__ == "__main__": autoescape=select_autoescape() ) - index = env.get_template( "index3.html" ) - viewer = env.get_template( "viewer2.html" ) - album = env.get_template( "album2.html" ) + index = env.get_template( "index.html" ) + viewer = env.get_template( "viewer.html" ) + album = env.get_template( "album.html" ) ls = os.listdir( f"{ args.output_path }/img/metadata/" ) m = dict() @@ -74,8 +74,8 @@ if __name__ == "__main__": #generate album files for i in range( nalbums ): json = jsonarray[i]; - nextalbum = "{ jsonarray[ (i+1)%nalbums ]['name'] }.html" - prevalbum = "{ jsonarray[ (i-1)%nalbums ]['name'] }.html" + nextalbum = f"{ jsonarray[ (i+1)%nalbums ]['name'] }.html" + prevalbum = f"{ jsonarray[ (i-1)%nalbums ]['name'] }.html" with open( f"{ args.output_path }/{ json['name'] }.html", "x" ) as f: f.write( album.render( nextalbum = nextalbum, prevalbum = prevalbum, title = json["name"], imgs = json["imgs"], csspath = "css/stylesheet.css", navbar = True ) ) @@ -87,8 +87,8 @@ if __name__ == "__main__": img = json["imgs"][i] exif = m[img] exifstring = "{} || {}s | f/{} | {} | ISO{} || {} + {} | {}".format( exif[2], exif[3], exif[4][1:], exif[5], exif[6], exif[7], exif[8], exif[9] ) - nexti = f"{ str( allimgs[ (i+1)%n ] ) }.html" - previ = f"{ str( allimgs[ (i-1)%n ] ) }.html" + nexti = f"{ str( json['imgs'][ (i+1)%n ] ) }.html" + previ = f"{ str( json['imgs'][ (i-1)%n ] ) }.html" with open( f"{ args.output_path }/img/viewer/{ json['name'] }/{ img }.html", "x" ) as f: f.write( viewer.render( navbar = True, fullrespath = "/img/fullres/", previewpath = "/img/preview/" , img = img, exif = exifstring, nexti = nexti, previ = previ ) )