diff --git a/src/album.py b/src/bulk_album.py similarity index 92% rename from src/album.py rename to src/bulk_album.py index c29ddf7..c3611c1 100644 --- a/src/album.py +++ b/src/bulk_album.py @@ -10,9 +10,9 @@ if TYPE_CHECKING: from path import Path env = Environment(loader=FileSystemLoader('src/templates')) -album_template = env.get_template('album.jinja') +album_template = env.get_template('bulk_album.jinja') -class Album(): +class BulkAlbum(): def __init__(self, name: str, albums_path: Path, pictures: list[Picture] = None, is_repertoried: bool = False): self.name: str = name diff --git a/src/page.py b/src/bulk_page.py similarity index 95% rename from src/page.py rename to src/bulk_page.py index 0e0ebb3..1222116 100644 --- a/src/page.py +++ b/src/bulk_page.py @@ -9,13 +9,13 @@ from path import Path from typing import TYPE_CHECKING if TYPE_CHECKING: - from page import Page + from bulk_page import Page from picture import Picture env = Environment(loader=FileSystemLoader('src/templates')) -page_template = env.get_template('page.jinja') +page_template = env.get_template('bulk_page.jinja') -class Page(): +class BulkPage(): def __init__(self, path: Path, name: str, pictures: list[Picture] = None, prev: Page|None = None, next: Page|None = None): self.name: str = name diff --git a/src/main.py b/src/main.py index 9ee597d..f930767 100644 --- a/src/main.py +++ b/src/main.py @@ -4,8 +4,8 @@ from progress.bar import Bar from path import Path from picture import Picture -from page import Page -from album import Album +from bulk_page import BulkPage +from bulk_album import BulkAlbum import argparse import config @@ -16,14 +16,14 @@ def argument_parsing(): args = parser.parse_args() return args -def scan_pages(folders: list[Path]) -> list[Page]: - pages: list[Page] = [] - prev: Page = None +def scan_pages(folders: list[Path]) -> list[BulkPage]: + pages: list[BulkPage] = [] + prev: BulkPage = None with Bar("Scanning Pages...", max=len(folders)) as bar: for folder in folders: files: list[Path] = folder.get_files() - page: Page = Page(folder, folder.get_name(), prev=prev) + page: BulkPage = BulkPage(folder, folder.get_name(), prev=prev) raw: Path = Path(folder, folder.get_name() + ".NEF") id: int = 0 @@ -46,28 +46,28 @@ def scan_pages(folders: list[Path]) -> list[Page]: pages[0].prev = pages[-1] return pages -def create_pages(pages: list[Page]) -> None: +def create_pages(pages: list[BulkPage]) -> None: with Bar("Generating Pages...", max=len(pages)) as bar: for page in pages: page.create() bar.next() -def scan_albums(pages: list[Page], albums_path: Path) -> list[Album]: - albums: dict[str, Album] = {} +def scan_albums(pages: list[BulkPage], albums_path: Path) -> list[BulkAlbum]: + albums: dict[str, BulkAlbum] = {} with Bar("Scanning pages...", max=len(pages)) as bar: for page in pages: for picture in page.get_pictures(): for album_name in picture.get_albums_name(): - album: Album | None = albums.get(album_name) + album: BulkAlbum | None = albums.get(album_name) if (album is None): - album = Album(album_name, albums_path) + album = BulkAlbum(album_name, albums_path) albums.update({album_name: album}) picture.albums.append(album) album.add_picture(picture) bar.next() return (albums.values()) -def create_albums(albums: list[Album]) -> None: +def create_albums(albums: list[BulkAlbum]) -> None: with Bar("Generating albums...", max=len(albums)) as bar: for album in albums: album.create() @@ -76,18 +76,18 @@ def create_albums(albums: list[Album]) -> None: def gen_bulk(bulk_path: Path): album_path: Path = Path(bulk_path, "albums") - pages: list[Page] = scan_pages(bulk_path.get_dirs()) - albums: list[Album] = scan_albums(pages, album_path) + pages: list[BulkPage] = scan_pages(bulk_path.get_dirs()) + albums: list[BulkAlbum] = 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")) + Path("./src/templates/bulk_page.css").copy_to(Path(bulk_path, "bulk_page.css")) create_pages(pages) - Path("./src/templates/album.css").copy_to(Path(bulk_path, "album.css")) + Path("./src/templates/bulk_album.css").copy_to(Path(bulk_path, "bulk_album.css")) if (not album_path.exist()): album_path.create() create_albums(albums) diff --git a/src/picture.py b/src/picture.py index b49c581..33ebef9 100644 --- a/src/picture.py +++ b/src/picture.py @@ -10,11 +10,11 @@ from typing import TYPE_CHECKING import config if TYPE_CHECKING: - from page import Page - from album import Album + from bulk_page import BulkPage + from bulk_album import Album class Picture(): - def __init__(self, picture_path: Path, id: int, page = None, raw: Path|None = None, is_repertoried: bool = True): + def __init__(self, picture_path: Path, id: int, page: BulkPage = None, raw: Path|None = None, is_repertoried: bool = True): self._large: Path = picture_path self._small: Path = Path(picture_path.get_absolute_path()[:-4] + "_small.jpg") self._thumb: Path = Path(picture_path.get_absolute_path()[:-4] + "_thumb.jpg") @@ -22,7 +22,7 @@ class Picture(): self._albums_file: Path = Path(picture_path.get_absolute_path()[:-4] + "_albums.txt") self._raw: Path|None = raw self.id: int = id - self._page: Page = page + self._page: BulkPage = page self._albums_name: list[str] = [] self.albums: list[Album] = [] if self._albums_file.exist(): diff --git a/src/templates/album.css b/src/templates/bulk_album.css similarity index 100% rename from src/templates/album.css rename to src/templates/bulk_album.css diff --git a/src/templates/album.jinja b/src/templates/bulk_album.jinja similarity index 86% rename from src/templates/album.jinja rename to src/templates/bulk_album.jinja index 4167a12..d13c1ac 100644 --- a/src/templates/album.jinja +++ b/src/templates/bulk_album.jinja @@ -2,7 +2,7 @@
- + diff --git a/src/templates/page.css b/src/templates/bulk_page.css similarity index 100% rename from src/templates/page.css rename to src/templates/bulk_page.css diff --git a/src/templates/page.jinja b/src/templates/bulk_page.jinja similarity index 97% rename from src/templates/page.jinja rename to src/templates/bulk_page.jinja index fdfb413..1295000 100644 --- a/src/templates/page.jinja +++ b/src/templates/bulk_page.jinja @@ -2,7 +2,7 @@ - +