slim-embedded-art: strip the ID3v1 appendix on rewrite (v1=0)

Redundant with the v2 frames, 128 bytes of legacy, and the thing whose
sync update tripped the audio guard. Applies to files being rewritten;
files already slimmed before this keep their synced v1.
This commit is contained in:
2026-08-29 02:05:50 +01:00
parent f63e6000f9
commit 8814f90780
+4 -1
View File
@@ -137,7 +137,10 @@ def process(path, apply):
t.delall("PIC")
t.add(APIC(encoding=0, mime="image/jpeg", type=3, desc="", data=jpeg))
v2 = 4 if tag.version >= (2, 4, 0) else 3
t.save(v2_version=v2, padding=lambda info: 0)
# v1=0 REMOVES any trailing ID3v1 tag: it is a 128-byte legacy appendix fully redundant
# with the v2 frames, and keeping it in sync is what tripped the audio guard before the
# guard learned to exclude it. Decided 2026-08-29: strip it wherever we rewrite.
t.save(v1=0, v2_version=v2, padding=lambda info: 0)
if audio_region_hash(tmp) != before:
raise RuntimeError("audio bytes changed - keeping original")
os.replace(tmp, path)