Skip to content

Ignorovať macOS AppleDouble súbory (._*) pri skenovaní fotiek - #20

Merged
emo546 merged 1 commit into
mainfrom
claude/nice-mccarthy-tleey2
Sep 16, 2026
Merged

emo546 merged 1 commit into
mainfrom
claude/nice-mccarthy-tleey2

Conversation

@emo546

@emo546 emo546 commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner

Čo sa mení

macOS pri kopírovaní na SMB share necháva vedľa každej fotky AppleDouble súbor s metadátami – rovnaké meno s predponou ._ (napr. ._IMG_0137.JPG). Podľa prípony je nerozoznateľný od skutočnej fotky, takže končil v zozname albumov, v počte fotiek, v indexe aj pri generovaní thumbnailov, kde PIL zlyhal (v súbore nie je obrázok).

Ako

  • Nový modul snapframe/rootfs/usr/bin/photofilter.py s jednou funkciou is_apple_double(name) – zámerne bez závislostí, aby ho mohol importovať aj webserver.py, aj watcher.py.
  • watcher.py: ._* HEIC sa nekonvertuje a originál sa nemaže; vynechaný aj zo scan_folder().
  • webserver.py: filter v _iter_photo_entries() a v pregenerate_thumbs(); safe_photo_path() odmieta ._* rovnako ako cesty mimo knižnice, takže ani priamy zásah na URL (/thumb, /photo, /exif, mazanie) taký súbor nevytiahne.
  • Filtrujú sa len AppleDouble súbory (._), nie bežné skryté súbory ako .DS_Store.

Testovanie

python -m unittest discover -s tests – 115 testov OK, žiadny skip. Nové testy v tests/test_watcher.py a tests/test_webserver.py pokrývajú skenovanie, thumbnaily aj odmietnutie cez safe_photo_path().

SMB shares written from macOS leave "._<name>" metadata files next to
real photos. These were classified as photos by extension alone, so
they showed up in album/photo listings and counts, and were fed to
PIL for thumbnail generation, producing "Thumbnail chyba ... cannot
identify image file" warnings. HEIC watcher had the same issue with
"._*.heic" files.

Add photofilter.is_apple_double() as a single shared predicate and use
it in webserver._iter_photo_entries, pregenerate_thumbs, and
safe_photo_path (so direct /thumb, /photo, /exif, /delete URL hits are
also rejected), and in watcher.scan_folder/process_file. Stale index
rows are removed automatically since pregenerate_thumbs' prune() no
longer sees these files as known photos.
@emo546
emo546 merged commit a9139c0 into main Sep 16, 2026
8 checks passed
@emo546
emo546 deleted the claude/nice-mccarthy-tleey2 branch September 17, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants