add: albums link under pictures
This commit is contained in:
26
src/main.py
26
src/main.py
@ -1,5 +1,4 @@
|
||||
import sys
|
||||
import shutil
|
||||
import os
|
||||
from progress.bar import Bar
|
||||
|
||||
@ -61,6 +60,7 @@ def scan_albums(pages: list[Page], albums_path: Path) -> list[Album]:
|
||||
if (album is None):
|
||||
album = Album(album_name, albums_path)
|
||||
albums.update({album_name: album})
|
||||
picture.albums.append(album)
|
||||
album.add_picture(picture)
|
||||
bar.next()
|
||||
return (albums.values())
|
||||
@ -72,17 +72,25 @@ def create_albums(albums: list[Album]) -> None:
|
||||
bar.next()
|
||||
|
||||
def gen_bulk(bulk_path: Path):
|
||||
pages: list[Page] = scan_pages(bulk_path.get_dirs())
|
||||
shutil.copy2("./src/templates/page.css", bulk_path.get_absolute_path())
|
||||
create_pages(pages)
|
||||
album_path: Path = Path(bulk_path, "albums")
|
||||
|
||||
pages: list[Page] = scan_pages(bulk_path.get_dirs())
|
||||
albums: list[Album] = scan_albums(pages, album_path)
|
||||
|
||||
if config.CREATE_GENERAL_ALBUM:
|
||||
for album in albums:
|
||||
if (album.name == "general"):
|
||||
album.path = Path(bulk_path, "general.html")
|
||||
|
||||
Path("./src/templates/page.css").copy_to(Path(bulk_path, "page.css"))
|
||||
create_pages(pages)
|
||||
|
||||
Path("./src/templates/album.css").copy_to(Path(bulk_path, "album.css"))
|
||||
if (not album_path.exist()):
|
||||
album_path.create()
|
||||
albums: list[Album] = scan_albums(pages, album_path)
|
||||
create_albums(albums)
|
||||
if config.CREATE_GENERAL_ALBUM:
|
||||
shutil.move(os.path.join(album_path.get_absolute_path(), "general.html"), os.path.join(bulk_path.get_absolute_path(), "index.html"))
|
||||
shutil.copy2("./src/templates/album.css", bulk_path.get_absolute_path())
|
||||
|
||||
|
||||
|
||||
def regen(bulk_path: Path, is_thumb: bool, is_small: bool):
|
||||
for page in scan_pages(bulk_path.get_dirs()):
|
||||
@ -96,7 +104,7 @@ def regen(bulk_path: Path, is_thumb: bool, is_small: bool):
|
||||
|
||||
def main():
|
||||
args = argument_parsing()
|
||||
bulk_path: Path = Path(args.site_path, "bulk")
|
||||
bulk_path: Path = Path(args.site_path, "bulk/")
|
||||
if args.regen is not None:
|
||||
regen(bulk_path, 't' in args.regen, 's' in args.regen)
|
||||
gen_bulk(bulk_path)
|
||||
|
Reference in New Issue
Block a user