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
+9 -2
View File
@@ -288,7 +288,11 @@ def main():
logger.debug('Response body unavailable (target closed) for %s', getattr(resp, 'url', '<unknown>'))
return
ext = guess_ext(ctype)
fname = f"{safe}_{h}_{ts}.{ext}"
# For images, avoid per-capture timestamps: use stable name with hash
if ctype.startswith('image/'):
fname = f"{safe}_{h}.{ext}"
else:
fname = f"{safe}_{h}_{ts}.{ext}"
body_path = str(output / fname)
save_binary(output / fname, data)
except Exception as e:
@@ -300,7 +304,10 @@ def main():
logger.debug('Response body unavailable (target closed) for %s', getattr(resp, 'url', '<unknown>'))
return
ext = guess_ext(ctype)
fname = f"{safe}_{h}_{ts}.{ext}"
if ctype.startswith('image/'):
fname = f"{safe}_{h}.{ext}"
else:
fname = f"{safe}_{h}_{ts}.{ext}"
body_path = str(output / fname)
save_binary(output / fname, data)
except Exception: