Skip to content

Commit ea305c5

Browse files
authored
Merge pull request #186 from adamkovacs2000/main
fix: process albumprops file in root folder.
2 parents 572fdca + ae44a39 commit ea305c5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

immich_auto_album.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Python script for creating albums in Immich from folder names in an external library."""
22

3+
# pylint: disable=too-many-lines
4+
35
from typing import Tuple
46
import argparse
57
import logging
@@ -529,7 +531,7 @@ def build_inheritance_chain_for_album_path(album_path: str, root_path: str, albu
529531
root_path = os.path.normpath(root_path)
530532

531533
# Walk up the directory tree until we reach the root path
532-
while current_path != root_path and len(current_path) > len(root_path):
534+
while len(current_path) >= len(root_path):
533535
albumprops_path = os.path.join(current_path, ALBUMPROPS_FILE_NAME)
534536

535537
if albumprops_path in albumprops_cache_param:
@@ -540,6 +542,10 @@ def build_inheritance_chain_for_album_path(album_path: str, root_path: str, albu
540542
if not album_model_local.inherit:
541543
break
542544

545+
# If we've reached the root path, stop
546+
if current_path == root_path:
547+
break
548+
543549
# Move up one directory level
544550
parent_path = os.path.dirname(current_path)
545551
if parent_path == current_path: # Reached filesystem root

0 commit comments

Comments
 (0)