mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 02:59:27 +00:00
non interactive
This commit is contained in:
@@ -169,6 +169,7 @@ def thumbnail_convert(arguments: tuple[str, str]):
|
|||||||
|
|
||||||
|
|
||||||
def listfolder(folder: str, title: str):
|
def listfolder(folder: str, title: str):
|
||||||
|
if not args.non_interactive:
|
||||||
pbar.desc = f"Generating html files - {folder}"
|
pbar.desc = f"Generating html files - {folder}"
|
||||||
pbar.update(0)
|
pbar.update(0)
|
||||||
items: list[str] = os.listdir(folder)
|
items: list[str] = os.listdir(folder)
|
||||||
@@ -187,6 +188,7 @@ def listfolder(folder: str, title: str):
|
|||||||
subfolders.extend([f'<figure><a href="{args.webroot}{urllib.parse.quote(folder.removeprefix(args.root))}/{urllib.parse.quote(item)}"><img src="{args.foldericon}" alt="Folder icon"/></a><figcaption><a href="{args.webroot}{urllib.parse.quote(folder.removeprefix(args.root))}/{urllib.parse.quote(item)}">{item}</a></figcaption></figure>'])
|
subfolders.extend([f'<figure><a href="{args.webroot}{urllib.parse.quote(folder.removeprefix(args.root))}/{urllib.parse.quote(item)}"><img src="{args.foldericon}" alt="Folder icon"/></a><figcaption><a href="{args.webroot}{urllib.parse.quote(folder.removeprefix(args.root))}/{urllib.parse.quote(item)}">{item}</a></figcaption></figure>'])
|
||||||
listfolder(os.path.join(folder, item), item)
|
listfolder(os.path.join(folder, item), item)
|
||||||
else:
|
else:
|
||||||
|
if not args.non_interactive:
|
||||||
pbar.desc = f"Generating html files - {folder}"
|
pbar.desc = f"Generating html files - {folder}"
|
||||||
pbar.update(0)
|
pbar.update(0)
|
||||||
contains_files = True
|
contains_files = True
|
||||||
@@ -207,6 +209,7 @@ 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.upper()}">RAW</a>'
|
image += f': <a href="{args.webroot}{urllib.parse.quote(folder.removeprefix(args.root))}/{urllib.parse.quote(os.path.splitext(item)[0])}{raw.upper()}">RAW</a>'
|
||||||
image += "</figcaption></figure>"
|
image += "</figcaption></figure>"
|
||||||
images.extend([image])
|
images.extend([image])
|
||||||
|
if not args.non_interactive:
|
||||||
pbar.desc = f"Generating html files - {folder}"
|
pbar.desc = f"Generating html files - {folder}"
|
||||||
pbar.update(0)
|
pbar.update(0)
|
||||||
if len(images) > 0 or (args.fancyfolders and not contains_files):
|
if len(images) > 0 or (args.fancyfolders and not contains_files):
|
||||||
@@ -233,12 +236,14 @@ def listfolder(folder: str, title: str):
|
|||||||
else:
|
else:
|
||||||
if os.path.exists(os.path.join(folder, "index.html")):
|
if os.path.exists(os.path.join(folder, "index.html")):
|
||||||
os.remove(os.path.join(folder, "index.html"))
|
os.remove(os.path.join(folder, "index.html"))
|
||||||
|
if not args.non_interactive:
|
||||||
pbar.update(1)
|
pbar.update(1)
|
||||||
|
|
||||||
|
|
||||||
def gettotal(folder):
|
def gettotal(folder):
|
||||||
global total
|
global total
|
||||||
|
|
||||||
|
if not args.non_interactive:
|
||||||
pbar.desc = f"Traversing filesystem - {folder}"
|
pbar.desc = f"Traversing filesystem - {folder}"
|
||||||
pbar.update(0)
|
pbar.update(0)
|
||||||
|
|
||||||
@@ -249,6 +254,7 @@ def gettotal(folder):
|
|||||||
if item not in excludes:
|
if item not in excludes:
|
||||||
if os.path.isdir(os.path.join(folder, item)):
|
if os.path.isdir(os.path.join(folder, item)):
|
||||||
total += 1
|
total += 1
|
||||||
|
if not args.non_interactive:
|
||||||
pbar.update(1)
|
pbar.update(1)
|
||||||
gettotal(os.path.join(folder, item))
|
gettotal(os.path.join(folder, item))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user