From 129dfe7df981b1d4496c77dc729419293584d652 Mon Sep 17 00:00:00 2001 From: Starnakin Date: Tue, 6 May 2025 22:42:22 +0200 Subject: [PATCH] add: hashtag to album page to go directly on the picture you clicked --- src/main.py | 4 +++- src/picture.py | 3 ++- src/templates/album.jinja | 2 +- src/templates/page.jinja | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index 6f7b636..9ee597d 100644 --- a/src/main.py +++ b/src/main.py @@ -26,9 +26,11 @@ def scan_pages(folders: list[Path]) -> list[Page]: page: Page = Page(folder, folder.get_name(), prev=prev) raw: Path = Path(folder, folder.get_name() + ".NEF") + id: int = 0 for file in files: if file.get_name().endswith(".png"): - page.add_picture(Picture(file, page=page, raw=raw)) + page.add_picture(Picture(file, id, page=page, raw=raw)) + id += 1 if len(page.get_pictures()) == 0: bar.next() diff --git a/src/picture.py b/src/picture.py index 5f4cea9..b49c581 100644 --- a/src/picture.py +++ b/src/picture.py @@ -14,13 +14,14 @@ if TYPE_CHECKING: from album import Album class Picture(): - def __init__(self, picture_path: Path, page = None, raw: Path|None = None, is_repertoried: bool = True): + def __init__(self, picture_path: Path, id: int, page = 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") self._profile_file: Path = Path(picture_path.get_absolute_path() + ".out.pp3") 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._albums_name: list[str] = [] self.albums: list[Album] = [] diff --git a/src/templates/album.jinja b/src/templates/album.jinja index 9f77af4..4167a12 100644 --- a/src/templates/album.jinja +++ b/src/templates/album.jinja @@ -9,7 +9,7 @@

{{ album.name }}

{% for picture in album._pictures %} - + {% endfor %} diff --git a/src/templates/page.jinja b/src/templates/page.jinja index d1df845..fdfb413 100644 --- a/src/templates/page.jinja +++ b/src/templates/page.jinja @@ -28,7 +28,7 @@ {% endif %}
{% for picture in page._pictures %} -
+
@@ -52,7 +52,7 @@ {% if page.get_raw().exist() %}

Download

- RAW + RAW
{% endif %} {% if page.get_exif() %}