diff --git a/help.svg b/help.svg index 0c6e7bf..467177f 100644 --- a/help.svg +++ b/help.svg @@ -1,4 +1,4 @@ - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + - + - + - - Usage:builder.py [-h] [-aAUTHOR] [-eEXTENSION] [-lLICENSE] [-m] [-n-pROOT-tTITLE-wURL -                  [--exclude-folderFOLDER] [--folderthumbnails] [--ignore-other-files] [--regenerate-thumbnails] -                  [--reread-metadata] [--reread-sidecar] [--reverse-sort] [--theme-pathPATH] [--use-fancy-folders] -                  [--version] - -generate HTML files for a static image hosting website - -Options: --h--helpshow this help message and exit --a--author-nameAUTHOR -name of the author of the images --e--file-extensionsEXTENSION -file extensions to include (can be specified multiple times) --l--license-typeLICENSE -specify the license type for the images --m--web-manifestgenerate a web manifest file --n--non-interactive-mode -run in non-interactive mode, disabling progress bars --p--root-directoryROOT -root directory containing the images --t--site-titleTITLE -title of the image hosting site --w--web-root-urlURL -base URL of the web root for the image hosting site ---exclude-folderFOLDER -folders to exclude from processing, globs supported (can be specified multiple times) ---folderthumbnailsgenerate subfolder thumbnails (first image in folder will be shown) ---ignore-other-filesignore files that do not match the specified extensions ---regenerate-thumbnails -regenerate thumbnails even if they already exist ---reread-metadatareread image metadata ---reread-sidecarreread sidecar files ---reverse-sortsort images in reverse order ---theme-pathPATHpath to the CSS theme file ---use-fancy-foldersenable fancy folder view instead of the default Apache directory listing ---versionshow program's version number and exit + + Usage:builder.py [-h] [-aAUTHOR] [-eEXTENSION] [-lLICENSE] [-m] [-n-pROOT-tTITLE-wURL +                  [--exclude-folderFOLDER] [--folderthumbnails] [--ignore-other-files] [--ignore-extensionEXTENSION] +                  [--regenerate-thumbnails] [--reread-metadata] [--reread-sidecar] [--reverse-sort] +                  [--theme-pathPATH] [--use-fancy-folders] [--version] + +generate HTML files for a static image hosting website + +Options: +-h--helpshow this help message and exit +-a--author-nameAUTHOR +name of the author of the images +-e--file-extensionsEXTENSION +file extensions to include (can be specified multiple times) +-l--license-typeLICENSE +specify the license type for the images +-m--web-manifestgenerate a web manifest file +-n--non-interactive-mode +run in non-interactive mode, disabling progress bars +-p--root-directoryROOT +root directory containing the images +-t--site-titleTITLE +title of the image hosting site +-w--web-root-urlURL +base URL of the web root for the image hosting site +--exclude-folderFOLDER +folders to exclude from processing, globs supported (can be specified multiple times) +--folderthumbnailsgenerate subfolder thumbnails (first image in folder will be shown) +--ignore-other-filesignore files that do not match the specified extensions +--ignore-extensionEXTENSION +file extensions to ignore (can be specified multiple times) +--regenerate-thumbnails +regenerate thumbnails even if they already exist +--reread-metadatareread image metadata +--reread-sidecarreread sidecar files +--reverse-sortsort images in reverse order +--theme-pathPATHpath to the CSS theme file +--use-fancy-foldersenable fancy folder view instead of the default Apache directory listing +--versionshow program's version number and exit diff --git a/modules/argumentparser.py b/modules/argumentparser.py index a00c4f0..98cc9ca 100644 --- a/modules/argumentparser.py +++ b/modules/argumentparser.py @@ -62,6 +62,7 @@ class Args: file_extensions: list[str] folder_thumbs: bool generate_webmanifest: bool + ignore_extensions: list[str] ignore_other_files: bool license_type: Optional[str] non_interactive_mode: bool @@ -82,6 +83,7 @@ class Args: result["file_extensions"] = self.file_extensions result["folder_thumbs"] = self.folder_thumbs result["generate_webmanifest"] = self.generate_webmanifest + result["ignore_extensions"] = self.ignore_extensions result["ignore_other_files"] = self.ignore_other_files if self.license_type is not None: result["license_type"] = self.license_type @@ -130,6 +132,7 @@ def parse_arguments(version: str) -> Args: if RICH: parser.add_argument("--generate-help-preview", action=HelpPreviewAction, path="help.svg", ) 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("--ignore-extension", help="file extensions to ignore (can be specified multiple times)", action="append", dest="ignore_extensions", metavar="EXTENSION") parser.add_argument("--regenerate-thumbnails", help="regenerate thumbnails even if they already exist", action="store_true", default=False, dest="regenerate_thumbnails") parser.add_argument("--reread-metadata", help="reread image metadata", action="store_true", default=False, dest="reread_metadata") parser.add_argument("--reread-sidecar", help="reread sidecar files", action="store_true", default=False, dest="reread_sidecar") @@ -146,6 +149,7 @@ def parse_arguments(version: str) -> Args: folder_thumbs=parsed_args.folder_thumbs, generate_webmanifest=parsed_args.generate_webmanifest, ignore_other_files=parsed_args.ignore_other_files, + ignore_extensions=parsed_args.ignore_extensions, license_type=parsed_args.license_type, non_interactive_mode=parsed_args.non_interactive_mode, regenerate_thumbnails=parsed_args.regenerate_thumbnails, diff --git a/modules/generate_html.py b/modules/generate_html.py index 0120e45..9b81b0a 100644 --- a/modules/generate_html.py +++ b/modules/generate_html.py @@ -428,7 +428,7 @@ def generate_html(folder: str, title: str, _args: Args, raw: list[str], version: logger.info("processing contents", extra={"folder": folder}) if not _args.non_interactive_mode: for item in tqdm(items, total=len(items), desc=f"Getting image infos - {folder}", unit="files", ascii=True, dynamic_ncols=True): - if item not in EXCLUDES and not item.startswith("."): + if item not in EXCLUDES and not item.startswith(".") and os.path.splitext(item)[1].lower() not in _args.ignore_extensions: if os.path.isdir(os.path.join(folder, item)): subfoldertags.update(process_subfolder(item, folder, baseurl, subfolders, _args, raw, version, logo)) else: @@ -442,7 +442,7 @@ def generate_html(folder: str, title: str, _args: Args, raw: list[str], version: process_license(folder, item) else: for item in items: - if item not in EXCLUDES and not item.startswith("."): + if item not in EXCLUDES and not item.startswith(".") and os.path.splitext(item)[1].lower() not in _args.ignore_extensions: if os.path.isdir(os.path.join(folder, item)): subfoldertags.update(process_subfolder(item, folder, baseurl, subfolders, _args, raw, version, logo)) else: