This commit is contained in:
2026-05-27 12:50:13 +02:00
parent 39ff5ca05c
commit 6ef637677e
5 changed files with 75 additions and 10 deletions
+7 -1
View File
@@ -347,7 +347,13 @@ def iter_photos(source: Path):
dirs[:] = [d for d in dirs if not d.startswith(".")]
for fname in files:
if Path(fname).suffix.lower() in SUPPORTED_EXTENSIONS:
yield Path(root) / fname
p = Path(root) / fname
# Přeskočit symlinky které vedou mimo share (WinError 3 - \\mnt\user\...)
try:
p.stat()
except OSError:
continue
yield p
def count_photos(source: Path) -> int:
+13 -6
View File
@@ -63,8 +63,14 @@ DB_CONFIG = {
}
# Překlad: Linux NFS cesta (jak je uložena v DB) → Windows UNC
LINUX_PREFIX = "/mnt/remotes/TOWER1.LAN_ZalohaVsechObrazku"
WINDOWS_UNC = "//Tower1/ZalohaVsechObrazku"
# Záznamy v DB mohou mít různé Linux prefixy podle toho, odkud byl scan spuštěn.
PATH_MAPPINGS = [
("/mnt/remotes/TOWER1.LAN_ZalohaVsechObrazku", "//Tower1/ZalohaVsechObrazku"),
("/mnt/user/ZalohaVsechObrazku", "//Tower1/ZalohaVsechObrazku"),
]
# Zpětná kompatibilita
LINUX_PREFIX = PATH_MAPPINGS[0][0]
WINDOWS_UNC = PATH_MAPPINGS[0][1]
SUPPORTED_EXTENSIONS = {".jpg", ".jpeg", ".png", ".heic", ".tiff", ".tif", ".webp", ".bmp"}
@@ -93,10 +99,11 @@ MIME_MAP = {
# ---------------------------------------------------------------------------
def linux_to_windows(linux_path: str) -> Path:
"""Převede /mnt/remotes/TOWER1.LAN_ZalohaVsechObrazku/... na //Tower1/ZalohaVsechObrazku/..."""
if linux_path.startswith(LINUX_PREFIX):
rel = linux_path[len(LINUX_PREFIX):] # začíná /
return Path(WINDOWS_UNC + rel)
"""Převede Linux NFS cestu na Windows UNC podle tabulky PATH_MAPPINGS."""
for linux_prefix, windows_unc in PATH_MAPPINGS:
if linux_path.startswith(linux_prefix):
rel = linux_path[len(linux_prefix):] # začíná /
return Path(windows_unc + rel)
return Path(linux_path)
# ---------------------------------------------------------------------------