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