feat: Improve file naming for captured images by removing timestamps for stable naming

This commit is contained in:
Ross
2025-10-20 07:58:21 +01:00
parent f1bfdd8e7a
commit fe41f1d02c
3 changed files with 53 additions and 11 deletions
+4 -2
View File
@@ -289,9 +289,10 @@ async def run(args):
ext = guess_ext(ctype)
# Put images into an images/ subdirectory, other binaries into assets/
if ctype.startswith('image/'):
# Images don't need per-capture timestamps; use stable names with hash
subdir = output / 'images'
subdir.mkdir(parents=True, exist_ok=True)
fname = f"{safe}_{h}_{ts}.{ext}"
fname = f"{safe}_{h}.{ext}"
body_path = str(subdir / fname)
save_binary(subdir / fname, data)
try:
@@ -314,9 +315,10 @@ async def run(args):
data = await resp.body()
ext = guess_ext(ctype)
if ctype.startswith('image/'):
# Fallback path for images: same stable naming without timestamp
subdir = output / 'images'
subdir.mkdir(parents=True, exist_ok=True)
fname = f"{safe}_{h}_{ts}.{ext}"
fname = f"{safe}_{h}.{ext}"
body_path = str(subdir / fname)
save_binary(subdir / fname, data)
try: