mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 11:09:26 +00:00
if no images default apache
This commit is contained in:
@@ -151,9 +151,7 @@ def listfolder(folder: str, title: str):
|
|||||||
if not os.path.exists(os.path.join(args.root, ".previews", folder.removeprefix(args.root))):
|
if not os.path.exists(os.path.join(args.root, ".previews", folder.removeprefix(args.root))):
|
||||||
os.mkdir(os.path.join(args.root, ".previews", folder.removeprefix(args.root)))
|
os.mkdir(os.path.join(args.root, ".previews", folder.removeprefix(args.root)))
|
||||||
|
|
||||||
with open(os.path.join(folder, "index.html"), "w", encoding="utf-8") as f:
|
|
||||||
temp_obj = Template(HTMLHEADER)
|
temp_obj = Template(HTMLHEADER)
|
||||||
f.write(temp_obj.substitute(title=title))
|
|
||||||
for item in items:
|
for item in items:
|
||||||
if item != "Galleries" and item != ".previews":
|
if item != "Galleries" and item != ".previews":
|
||||||
if os.path.isdir(os.path.join(folder, item)):
|
if os.path.isdir(os.path.join(folder, item)):
|
||||||
@@ -177,6 +175,9 @@ def listfolder(folder: str, title: str):
|
|||||||
image += f': <a href="{args.webroot}{urllib.parse.quote(folder.removeprefix(args.root))}/{urllib.parse.quote(os.path.splitext(item)[0])}{raw}">RAW</a>'
|
image += f': <a href="{args.webroot}{urllib.parse.quote(folder.removeprefix(args.root))}/{urllib.parse.quote(os.path.splitext(item)[0])}{raw}">RAW</a>'
|
||||||
image += "</figcaption></figure>"
|
image += "</figcaption></figure>"
|
||||||
images.extend([image])
|
images.extend([image])
|
||||||
|
if len(images) > 0:
|
||||||
|
with open(os.path.join(folder, "index.html"), "w", encoding="utf-8") as f:
|
||||||
|
f.write(temp_obj.substitute(title=title))
|
||||||
f.write(' <div class="header">\n')
|
f.write(' <div class="header">\n')
|
||||||
f.write(f" <h1>{title}</h1>\n")
|
f.write(f" <h1>{title}</h1>\n")
|
||||||
f.write(' <div class="folders">\n')
|
f.write(' <div class="folders">\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user