From e1db6c84f215ae4f46812afd28b9804492760321 Mon Sep 17 00:00:00 2001 From: bernd Date: Thu, 1 Oct 2026 23:11:49 +0200 Subject: [PATCH] editor.py aktualisiert --- editor.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/editor.py b/editor.py index afc581d..6b20070 100644 --- a/editor.py +++ b/editor.py @@ -356,8 +356,16 @@ def create_waveform(filename): try: if output.is_file() and output.stat().st_mtime >= source.stat().st_mtime: - return output - except FileNotFoundError: + # Rebuild older cached waveforms when their resolution is below + # the current 9600x240 waveform resolution. + with output.open("rb") as fh: + header = fh.read(24) + if (header.startswith(b"\x89PNG\r\n\x1a\n") + and len(header) >= 24 + and int.from_bytes(header[16:20], "big") == 9600 + and int.from_bytes(header[20:24], "big") == 240): + return output + except (FileNotFoundError, OSError): pass temp = output.with_suffix(".tmp.png") @@ -367,7 +375,7 @@ def create_waveform(filename): "ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-i", str(source), "-filter_complex", - "aformat=channel_layouts=mono,showwavespic=s=2400x240:split_channels=0", + "aformat=channel_layouts=mono,showwavespic=s=9600x240:split_channels=0", "-frames:v", "1", str(temp), ], @@ -868,8 +876,8 @@ h1 { margin:0 0 6px; font-size:28px; } .editor { background:var(--color-surface); border:1px solid var(--color-border); border-radius:10px; padding:20px; } .wave-wrap { position:relative; width:100%; height:240px; background:var(--color-surface-dark); border-radius:6px; overflow:hidden; user-select:none; touch-action:none; } .wave-image { position:absolute; top:0; left:0; width:100%; height:100%; object-fit:fill; display:block; opacity:.9; pointer-events:none; } -.selection { position:absolute; top:0; bottom:0; background:var(--color-selection); border-left:2px solid var(--color-white); border-right:2px solid var(--color-white); pointer-events:none; } -.playhead { position:absolute; top:0; bottom:0; width:2px; margin-left:-1px; background:var(--color-accent); box-shadow:0 0 5px var(--color-shadow); z-index:4; pointer-events:none; } +.selection { position:absolute; top:0; bottom:0; background:rgba(48,115,142,.48); border-left:2px solid #ffffff; border-right:2px solid #ffffff; pointer-events:none; } +.playhead { position:absolute; top:0; bottom:0; width:2px; margin-left:-1px; background:#ffcc33; box-shadow:0 0 5px #000, 0 0 10px rgba(255,204,51,.85); z-index:4; pointer-events:none; } .handle { position:absolute; top:0; bottom:0; width:18px; margin-left:-9px; cursor:ew-resize; z-index:3; touch-action:none; } .handle::after { content:""; position:absolute; left:7px; top:0; bottom:0; width:4px; background:var(--color-white); border-radius:2px; box-shadow:0 0 5px var(--color-shadow); } .view-scroll { position:relative; width:100%; height:14px; margin-top:5px; background:var(--color-border-subtle); border-radius:7px; overflow:hidden; touch-action:none; cursor:grab; }