w22
This commit is contained in:
@@ -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)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user