feat: Improve file naming for captured images by removing timestamps for stable naming
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user