fix(immichup): Add images to studio albums

This commit is contained in:
abdus committed 2026-10-10 16:40:53 +02:00
1 parent 4d3b6ec06d
commit d5a4764c4b
2 files changed
+57 -3

No files matched your search

+4 -3
View File
@@ -24,11 +24,10 @@ from typing import Any, Sequence
import httpx
LOG = logging.getLogger("immichup")
TAG_PORTRAIT = "aspect:portrait"
TAG_LANDSCAPE = "aspect:landscape"
STUDIO_RE = re.compile(r"\b@(\S+)\b")
STUDIO_RE = re.compile(r"@([^_\s]+)")
def parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
@@ -68,7 +67,8 @@ def parse_filename(image_path: Path) -> tuple[list[str], str | None] | None:
if not people:
return None
match = STUDIO_RE.search(filename)
return people, match.group(1) if match else None
studio = match.group(1) if match else None
return people, studio
def read_jpeg_dimensions(path: Path) -> tuple[int, int]:
@@ -216,6 +216,7 @@ def process_image(path: Path, client: ImmichClient | None, dry_run: bool) -> boo
albums = [person.lower() for person in people]
tags = list(albums)
if studio:
albums.append(f"@{studio.lower()}")
tags.append(studio.lower())
tags.append(TAG_PORTRAIT if width <= height else TAG_LANDSCAPE)
if dry_run: