diff --git a/StaticGalleryBuilder.code-workspace b/StaticGalleryBuilder.code-workspace
index 2667c26..ca33b8d 100644
--- a/StaticGalleryBuilder.code-workspace
+++ b/StaticGalleryBuilder.code-workspace
@@ -70,9 +70,9 @@
"console": "integratedTerminal",
"args": [
"-p",
- "/mnt/nfs/pictures",
+ "/home/user/Pictures",
"-w",
- "https://pictures.sorogon.eu",
+ "file:///home/user/Pictures",
"-t",
"Pictures",
"--theme",
@@ -89,7 +89,7 @@
"tasks": [
{
"label": "Delete Lockfile",
- "command": "rm -f /mnt/nfs/pictures/.lock",
+ "command": "rm -f /home/user/Pictures/.lock",
"type": "shell",
"problemMatcher": [],
"isBackground": true
diff --git a/builder.py b/builder.py
index 89858be..94daf28 100755
--- a/builder.py
+++ b/builder.py
@@ -3,6 +3,7 @@ import os
import argparse
import urllib.parse
import shutil
+import fnmatch
from multiprocessing import Pool
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
@@ -25,7 +26,7 @@ VERSION = "1.7.0"
RAW_EXTENSIONS = [".3fr", ".ari", ".arw", ".bay", ".braw", ".crw", ".cr2", ".cr3", ".cap", ".data", ".dcs", ".dcr", ".dng", ".drf", ".eip", ".erf", ".fff", ".gpr", ".iiq", ".k25", ".kdc", ".mdc", ".mef", ".mos", ".mrw", ".nef", ".nrw", ".obm", ".orf", ".pef", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rwl", ".rw2", ".rwz", ".sr2", ".srf", ".srw", ".tif", ".tiff", ".x3f"]
IMG_EXTENSIONS = [".jpg", ".jpeg"]
EXCLUDES = [".lock", "index.html", ".thumbnails", ".static"]
-NOT_LIST = ["Galleries", "Archives"]
+NOT_LIST = ["*/Galleries/*", "Archives"]
# fmt: on
# Initialize Jinja2 environment
@@ -63,7 +64,7 @@ def parse_arguments() -> Args:
parser.add_argument("--theme-path", help="Path to the CSS theme file.", default=DEFAULT_THEME_PATH, type=str, dest="theme_path", metavar="PATH")
parser.add_argument("--use-fancy-folders", help="Enable fancy folder view instead of the default Apache directory listing.", action="store_true", default=False, dest="use_fancy_folders")
parser.add_argument("--ignore-other-files", help="Ignore files that do not match the specified extensions.", action="store_true", default=False, dest="ignore_other_files")
- parser.add_argument("--exclude-folder", help="Folders to exclude from processing (can be specified multiple times).", action="append", dest="exclude_folders", metavar="FOLDER")
+ parser.add_argument("--exclude-folder", help="Folders to exclude from processing, globs supported (can be specified multiple times).", action="append", dest="exclude_folders", metavar="FOLDER")
parser.add_argument("--version", action="version", version=f"%(prog)s {VERSION}")
parser.add_argument("--generate-help-preview", action=HelpPreviewAction, path="help.svg")
parsed_args = parser.parse_args()
@@ -152,7 +153,12 @@ def list_folder(folder: str, title: str) -> None:
subfolder = {"url": f"{args.web_root_url}{baseurl}{urllib.parse.quote(item)}", "name": item}
subfolders.append(subfolder)
if item not in args.exclude_folders:
- list_folder(os.path.join(folder, item), os.path.join(folder, item).removeprefix(args.root_directory))
+ skip = False
+ for exclude in args.exclude_folders:
+ if fnmatch.fnmatchcase(os.path.join(folder, item), exclude):
+ skip = True
+ if not skip:
+ list_folder(os.path.join(folder, item), os.path.join(folder, item).removeprefix(args.root_directory))
else:
extsplit = os.path.splitext(item)
contains_files = True
@@ -237,9 +243,9 @@ def main() -> None:
exit()
try:
+ Path(os.path.join(args.root_directory, ".lock")).touch()
if not os.path.exists(os.path.join(args.root_directory, ".thumbnails")):
os.mkdir(os.path.join(args.root_directory, ".thumbnails"))
- Path(os.path.join(args.root_directory, ".lock")).touch()
print("Copying static files...")
copy_static_files(args)
diff --git a/help.svg b/help.svg
index f6d53b5..d018641 100644
--- a/help.svg
+++ b/help.svg
@@ -19,126 +19,126 @@
font-weight: 700;
}
- .terminal-133953017-matrix {
+ .terminal-3216112738-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-133953017-title {
+ .terminal-3216112738-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-133953017-r1 {
+ .terminal-3216112738-r1 {
fill: #ff8700
}
- .terminal-133953017-r2 {
+ .terminal-3216112738-r2 {
fill: #c5c8c6
}
- .terminal-133953017-r3 {
+ .terminal-3216112738-r3 {
fill: #808080
}
- .terminal-133953017-r4 {
+ .terminal-3216112738-r4 {
fill: #68a0b3
}
- .terminal-133953017-r5 {
+ .terminal-3216112738-r5 {
fill: #00af87
}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -150,135 +150,137 @@
-
+
-
- Usage:builder.py [-h] -pROOT-wURL-tTITLE [-r] [-n] [-lLICENSE] [-aAUTHOR] [-eEXTENSION] [--theme-pathPATH]
- [--use-fancy-folders] [--ignore-other-files] [--exclude-folderFOLDER] [--version]
-
- Generate HTML files for a static image hosting website.
-
- Options:
- -h, --helpshow this help message and exit
- -p, --root-directoryROOT
- Root directory containing the images.
- -w, --web-root-urlURL
- Base URL of the web root for the image hosting site.
- -t, --site-titleTITLE
- Title of the image hosting site.
- -r, --regenerate-thumbnails
- Regenerate thumbnails even if they already exist.
- -n, --non-interactive-mode
- Run in non-interactive mode, disabling progress bars.
- -l, --license-typeLICENSE
- Specify the license type for the images.
- -a, --author-nameAUTHOR
- Name of the author of the images.
- -e, --file-extensionsEXTENSION
- File extensions to include (can be specified multiple times).
- --theme-pathPATHPath to the CSS theme file.
- --use-fancy-foldersEnable fancy folder view instead of the default Apache directory listing.
- --ignore-other-files
+ Usage:builder.py [-h] -pROOT-wURL-tTITLE [-r] [-n] [-lLICENSE] [-aAUTHOR] [-eEXTENSION] [--theme-pathPATH]
+ [--use-fancy-folders] [--ignore-other-files] [--exclude-folderFOLDER] [--version]
+
+ Generate HTML files for a static image hosting website.
+
+ Options:
+ -h, --helpshow this help message and exit
+ -p, --root-directoryROOT
+ Root directory containing the images.
+ -w, --web-root-urlURL
+ Base URL of the web root for the image hosting site.
+ -t, --site-titleTITLE
+ Title of the image hosting site.
+ -r, --regenerate-thumbnails
+ Regenerate thumbnails even if they already exist.
+ -n, --non-interactive-mode
+ Run in non-interactive mode, disabling progress bars.
+ -l, --license-typeLICENSE
+ Specify the license type for the images.
+ -a, --author-nameAUTHOR
+ Name of the author of the images.
+ -e, --file-extensionsEXTENSION
+ File extensions to include (can be specified multiple times).
+ --theme-pathPATHPath to the CSS theme file.
+ --use-fancy-foldersEnable fancy folder view instead of the default Apache directory listing.
+ --ignore-other-filesIgnore files that do not match the specified extensions.
- --exclude-folderFOLDER
- Folders to exclude from processing (can be specified multiple times).
- --versionshow program's version number and exit
+ clip-path="url(#terminal-3216112738-line-25)">Ignore files that do not match the specified extensions.
+ --exclude-folderFOLDER
+ Folders to exclude from processing, globs supported (can be specified multiple times).
+ --versionshow program's version number and exit