diff --git a/README.md b/README.md index 2c51253..14a23f5 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ The script supports several command-line options to customize its behavior. Belo - `-p ROOT, --root-directory ROOT`: Specify the root folder where the images are stored. This option is required. - `-w WEBROOT, --web-root-url WEBROOT`: Specify the web root URL where the images will be accessible. This option is required. - `-t TITLE, --site-title TITLE`: Specify the title for the root directory HTML file. This option is required. -- `-i ICON, --folder-icon-url ICON`: Specify the URL for the folder icon. Default is `https://www.svgrepo.com/show/400249/folder.svg`. - `-r, --regenerate-thumbnails`: Regenerate thumbnails even if they already exist. - `-n, --non-interactive-mode`: Disable interactive mode, which is useful for automated workflows. - `--use-fancy-folders`: Use fancy folders instead of the default Apache directory listing. diff --git a/files/global.css b/files/global.css index 9e31819..020efa3 100644 --- a/files/global.css +++ b/files/global.css @@ -13,10 +13,8 @@ body { .folders { text-align: center; display: -ms-flexbox; - /* IE10 */ display: flex; -ms-flex-wrap: wrap; - /* IE10 */ flex-wrap: wrap; justify-content: space-evenly; overflow: hidden; @@ -46,10 +44,8 @@ body { .row { display: -ms-flexbox; - /* IE10 */ display: flex; -ms-flex-wrap: wrap; - /* IE10 */ flex-wrap: wrap; padding: 0 2px; } @@ -61,7 +57,6 @@ figure { /* Create four equal columns that sits next to each other */ .column { -ms-flex: 12.5%; - /* IE10 */ flex: 12.5%; max-width: 12.5%; padding: 0 4px; @@ -168,4 +163,4 @@ figure { text-align: center; padding: 14px 16px; text-decoration: none; -} \ No newline at end of file +} diff --git a/generate_html.py b/generate_html.py index 79011fa..604c1eb 100755 --- a/generate_html.py +++ b/generate_html.py @@ -14,13 +14,12 @@ import cclicense # fmt: off # Constants -DEFAULT_FOLDER_ICON = "https://www.svgrepo.com/show/400249/folder.svg" STATIC_FILES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "files") FAVICON_PATH = ".static/favicon.ico" GLOBAL_CSS_PATH = ".static/global.css" DEFAULT_THEME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "themes", "default.css") DEFAULT_AUTHOR = "Author" -VERSION = "1.4" +VERSION = "1.5" 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"] @@ -31,11 +30,11 @@ NOT_LIST = ["Galleries", "Archives"] env = Environment(loader=FileSystemLoader(os.path.join(os.path.abspath(os.path.dirname(__file__)), "templates"))) thumbnails: List[Tuple[str, str]] = [] + class Args: root_directory: str web_root_url: str site_title: str - folder_icon_url: str regenerate_thumbnails: bool non_interactive_mode: bool use_fancy_folders: bool @@ -52,7 +51,6 @@ def parse_arguments() -> Args: parser.add_argument("-p", "--root-directory", help="Root directory containing the images.", required=True, type=str, dest="root_directory") parser.add_argument("-w", "--web-root-url", help="Base URL of the web root for the image hosting site.", required=True, type=str, dest="web_root_url") parser.add_argument("-t", "--site-title", help="Title of the image hosting site.", required=True, type=str, dest="site_title") - parser.add_argument("-i", "--folder-icon-url", help="URL of the icon used for folders.", default=DEFAULT_FOLDER_ICON, type=str, metavar="ICON", dest="folder_icon_url") parser.add_argument("-r", "--regenerate-thumbnails", help="Regenerate thumbnails even if they already exist.", action="store_true", default=False, dest="regenerate_thumbnails") parser.add_argument("-n", "--non-interactive-mode", help="Run in non-interactive mode, disabling progress bars.", action="store_true", default=False, dest="non_interactive_mode") parser.add_argument("-l", "--license-type", help="Specify the license type for the images.", choices=["cc-zero", "cc-by", "cc-by-sa", "cc-by-nd", "cc-by-nc", "cc-by-nc-sa", "cc-by-nc-nd"], default=None, dest="license_type") @@ -69,7 +67,6 @@ def parse_arguments() -> Args: args.root_directory = parsed_args.root_directory args.web_root_url = parsed_args.web_root_url args.site_title = parsed_args.site_title - args.folder_icon_url = parsed_args.folder_icon_url args.regenerate_thumbnails = parsed_args.regenerate_thumbnails args.non_interactive_mode = parsed_args.non_interactive_mode args.use_fancy_folders = parsed_args.use_fancy_folders @@ -113,12 +110,17 @@ def generate_thumbnail(arguments: Tuple[str, str]) -> None: def get_total_folders(folder: str) -> None: global total + + total += 1 + + pbar.desc = f"Traversing filesystem - {folder}" + pbar.update(1) + items = os.listdir(folder) items.sort() for item in items: if item not in EXCLUDES: if os.path.isdir(os.path.join(folder, item)): - total += 1 if item not in args.exclude_folders: get_total_folders(os.path.join(folder, item)) @@ -191,7 +193,6 @@ def list_folder(folder: str, title: str) -> None: root=args.web_root_url, parent=parent, header=header, - foldericon=args.folder_icon_url, license=license_info, subdirectories=subfolders, images=image_chunks, @@ -234,7 +235,7 @@ def main() -> None: pbar.update(0) pbar.close() - pbar = tqdm(total=total + 1, desc="Generating HTML files", unit="files", ascii=True, dynamic_ncols=True) + pbar = tqdm(total=total, desc="Generating HTML files", unit="files", ascii=True, dynamic_ncols=True) list_folder(args.root_directory, args.site_title) pbar.desc = "Generating html files" pbar.update(0) diff --git a/templates/index.html.j2 b/templates/index.html.j2 index be69249..4c34c17 100644 --- a/templates/index.html.j2 +++ b/templates/index.html.j2 @@ -28,7 +28,7 @@
{%- for subdirectory in subdirectories %}
- Folder icon +
{{ subdirectory.name }}
{%- endfor %} diff --git a/themes/default-dark.css b/themes/default-dark.css index 111f30a..a60fb2e 100644 --- a/themes/default-dark.css +++ b/themes/default-dark.css @@ -1,3 +1,5 @@ +@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap"); + .navbar { font-weight: bold; color: #e8e6e3; @@ -17,13 +19,35 @@ .license { color: #e8e6e3; background-color: #313537; + font-weight: 500; +} + +.license a { + color: #5483ef; + text-decoration: none; +} + +.folders img { + content: url(https://www.svgrepo.com/show/474853/gallery.svg); +} + +.folders a { + font-weight: 700; + color: #5483ef; + text-decoration: none; } body { color: #e8e6e3; background-color: #181a1b; + font-family: "Ubuntu", sans-serif; + font-optical-sizing: auto; + font-weight: 400; + font-style: normal; } -a { +body a { + font-weight: 400; color: #5483ef; -} \ No newline at end of file + text-decoration: none; +} diff --git a/themes/default.css b/themes/default.css index 760f643..d83dd54 100644 --- a/themes/default.css +++ b/themes/default.css @@ -1,3 +1,5 @@ +@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap"); + .navbar { font-weight: bold; color: #fff; @@ -5,7 +7,7 @@ } .navbar li a { - font-weight: bold; + font-weight: 700; color: #fff; } @@ -17,8 +19,35 @@ .license { color: #000; background-color: #ddd; + font-weight: 500; +} + +.license a { + color: #0055ff; + text-decoration: none; +} + +.folders img { + content: url(https://www.svgrepo.com/show/474852/folder.svg); +} + +.folders a { + font-weight: 700; + color: #0055ff; + text-decoration: none; } body { + color: #000; background-color: #fff; -} \ No newline at end of file + font-family: "Ubuntu", sans-serif; + font-optical-sizing: auto; + font-weight: 400; + font-style: normal; +} + +body a { + font-weight: 400; + color: #0055ff; + text-decoration: none; +} diff --git a/themes/kjoe.css b/themes/kjoe.css new file mode 100644 index 0000000..4392f57 --- /dev/null +++ b/themes/kjoe.css @@ -0,0 +1,70 @@ +@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap"); + +.navbar { + font-weight: bold; + color: #ebebeb; + background-color: #260000; + font-weight: 900; +} + +.navbar li a { + font-weight: 800; + color: #ebebeb; +} + +/* Change the link color on hover */ +.navbar li a:hover { + font-weight: 900; + text-decoration: none; +} + +.license { + color: #ebebeb; + background-color: #191313; + font-weight: 700; +} + +.license a { + color: #ff2727; + text-decoration: none; +} + +.license a:hover { + font-weight: 800; + text-decoration: none; +} + +.folders img { + content: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 0 1024 1024' class='icon' version='1.1' xmlns='http://www.w3.org/2000/svg' fill='%23000000'%3E%3Cg id='SVGRepo_bgCarrier' stroke-width='0' /%3E%3Cg id='SVGRepo_tracerCarrier' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cg id='SVGRepo_iconCarrier'%3E%3Cpath d='M853.333333 256H469.333333l-85.333333-85.333333H170.666667c-46.933333 0-85.333333 38.4-85.333334 85.333333v170.666667h853.333334v-85.333334c0-46.933333-38.4-85.333333-85.333334-85.333333z' fill='%238e0000' /%3E%3Cpath d='M853.333333 256H170.666667c-46.933333 0-85.333333 38.4-85.333334 85.333333v426.666667c0 46.933333 38.4 85.333333 85.333334 85.333333h682.666666c46.933333 0 85.333333-38.4 85.333334-85.333333V341.333333c0-46.933333-38.4-85.333333-85.333334-85.333333z' fill='%23FF2727' /%3E%3C/g%3E%3C/svg%3E"); + fill: #f00f0f; +} + +.folders a { + font-weight: 800; + color: #ebebeb; + text-decoration: none; +} + +.folders a:hover { + font-weight: 900; + text-decoration: none; +} + +.row a { + font-weight: 800; + color: #ff2727; + text-decoration: none; +} + +.row a:hover { + text-decoration: underline; +} + +body { + color: #ebebeb; + background-color: #171717; + font-family: "Montserrat", sans-serif; + font-optical-sizing: auto; + font-weight: 700; + font-style: normal; +} diff --git a/themes/monokai-vibrant.css b/themes/monokai-vibrant.css index 0647272..c3a4083 100644 --- a/themes/monokai-vibrant.css +++ b/themes/monokai-vibrant.css @@ -1,30 +1,54 @@ -.navbar { - font-weight: bold; - color: #f6f6f6; - background-color: #191b20; - } - - .navbar li a { - font-weight: bold; - color: #f6f6f6; - } - - /* Change the link color on hover */ - .navbar li a:hover { - background-color: #2c313a; - } - - .license { - color: #f6f6f6; - background-color: #2c313a; - } - - body { - color: #f6f6f6; - background-color: #16171d - } +@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap"); - a { - font-weight: bold; - color: #ffd945; - } \ No newline at end of file +.navbar { + font-weight: bold; + color: #f6f6f6; + background-color: #191b20; + font-weight: 900; +} + +.navbar li a { + font-weight: 900; + color: #f6f6f6; +} + +/* Change the link color on hover */ +.navbar li a:hover { + background-color: #2c313a; +} + +.license { + color: #f6f6f6; + background-color: #2c313a; + font-weight: 700; +} + +.license a { + color: #528bff; + text-decoration: none; +} + +.folders img { + content: url(https://www.svgrepo.com/show/400249/folder.svg); +} + +.folders a { + font-weight: 900; + color: #ffd945; + text-decoration: none; +} + +body { + color: #f6f6f6; + background-color: #16171d; + font-family: "Montserrat", sans-serif; + font-optical-sizing: auto; + font-weight: 800; + font-style: normal; +} + +body a { + font-weight: 900; + color: #e542ff; + text-decoration: none; +}