From de8949efa7d92a2e58b0e0d2cddfba30c2edc246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sat, 29 Aug 2026 08:39:14 +0100 Subject: [PATCH] slim-embedded-art: rewrite tags that are mostly padding The final 47 oversized files held no big art and no big lyrics - just empty reserved space, up to 478 KB of padding against 39 bytes of frames, all in the DJ Sets tree. The player pages through padding like anything else. A tag past 200 KB total is rewritten regardless of what fills it; the save already zeroes padding. --- scripts/slim-embedded-art.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/slim-embedded-art.py b/scripts/slim-embedded-art.py index bafc363..d4e3fed 100755 --- a/scripts/slim-embedded-art.py +++ b/scripts/slim-embedded-art.py @@ -43,6 +43,11 @@ PROCESS_OVER = 100_000 # McCourt's "Angela's Ashes" - 1.5 MB of memoir in an Eels track's USLT, courtesy of some tagger # malfunction - and AVPlayer pages through ALL of it before the first audio frame, art or not. LYRICS_SANE = 50_000 +# The last 47 oversized files held no big art and no big lyrics - just PADDING: empty space some +# tagger reserved for future edits, up to 478 KB of it against 39 bytes of actual frames (the DJ +# Sets tree, 2026-08-29). The player pages through padding like anything else, so a tag this far +# past its content gets rewritten (the save already zeroes padding). +TAG_SANE = 200_000 def audio_region_hash(path, offset=None): @@ -125,13 +130,15 @@ def process(path, apply): pics = pictures(tag) total = sum(len(p.data) for p in pics) junk_lyrics = [f for f in tag.getall("USLT") if len(f.text or "") > LYRICS_SANE] - if total <= PROCESS_OVER and not junk_lyrics: + bloated = tag.size > TAG_SANE + if total <= PROCESS_OVER and not junk_lyrics and not bloated: return None largest = max(pics, key=lambda p: len(p.data)) if pics else None if not apply: parts = [] if total > PROCESS_OVER: parts.append(f"{total // 1024} KB of art") if junk_lyrics: parts.append(f"{sum(len(f.text) for f in junk_lyrics) // 1024} KB of junk lyrics") + if not parts and bloated: parts.append(f"{tag.size // 1024} KB tag of mostly padding") return "would slim " + " + ".join(parts) before = audio_region_hash(path)