fix: mtime index dans processed_full, print 404, galerie full-width
This commit is contained in:
+14
-10
@@ -50,20 +50,24 @@ async def api_gallery_photos(
|
||||
if ev:
|
||||
started_at = ev["started_at"] or 0.0
|
||||
ended_at = ev["ended_at"] or datetime.now().timestamp()
|
||||
# Construire un index mtime par stem ET par nom complet
|
||||
# Construire un index mtime : cherche dans media_dir et ses sous-dossiers connus
|
||||
mtime_index: dict[str, float] = {}
|
||||
for media_dir_candidate in [
|
||||
Path(cfg.photobooth.media_dir),
|
||||
base = Path(cfg.photobooth.media_dir)
|
||||
checked: set = set()
|
||||
for candidate in [
|
||||
base,
|
||||
base / "processed_full",
|
||||
Path("/home/pi/photobooth-data/media/processed_full"),
|
||||
Path("/home/pi/photobooth-data/media"),
|
||||
]:
|
||||
if media_dir_candidate.exists():
|
||||
for f in media_dir_candidate.iterdir():
|
||||
if f.is_file():
|
||||
mt = f.stat().st_mtime
|
||||
mtime_index[f.name] = mt # uuid.jpg
|
||||
mtime_index[f.stem] = mt # uuid
|
||||
break
|
||||
if not candidate.exists() or candidate in checked:
|
||||
continue
|
||||
checked.add(candidate)
|
||||
for f in candidate.iterdir():
|
||||
if f.is_file() and f.suffix.lower() in (".jpg", ".jpeg", ".png"):
|
||||
mt = f.stat().st_mtime
|
||||
mtime_index[f.name] = mt
|
||||
mtime_index[f.stem] = mt
|
||||
|
||||
def _in_event(p: dict) -> bool:
|
||||
pid = _get_id(p)
|
||||
|
||||
Reference in New Issue
Block a user