v0.16.0: the file already told you

Two real failures from the first hour of round 45, both fixed by treating
the file itself as evidence.

"B. Clem - Zuuso [1025657891]" fingerprinted fine and matched nothing.
Checked before building: AcoustID returns zero results, a MusicBrainz text
search for "Zuuso" returns zero, iTunes returns zero. The track is in no
metadata service on earth, so no smarter lookup could have answered it —
but its filename said exactly what it was. New filename_tags.py reads that,
validated against all 474 files in the untagged folder rather than invented
examples: it strips yt-dlp ids, drops "(Official Video)" noise, splits
Artist - Title, reads a leading 1-04, and falls back to the iTunes tree.
It is careful about what it removes — an 11-char trailing token counts as a
YouTube id only if it carries a digit, an underscore or flipping case, or
"Cold Draft-Underground" loses a word, and a hyphen only splits when it has
spaces around it so Jay-Z survives.

A guess says it is one: candidates carry a source, and the dialog quotes a
confidence only for real fingerprint matches.

The file now ranks lookup results too, which fixes the Alhambra case: token
overlap (words double, bare numbers single), a duration bucket against the
recording lengths AcoustID returns, and a filename year that predates what
the database knows. Live also stops counting as a demerit — it was lumped in
with Compilation and buried a live album for a file whose name said "Live At
The Alhambra". That track now proposes the right album with year 1961
instead of a compilation with 2002.

The year genuinely needed the filename: MusicBrainz's own first-release-date
for "Ahmad Jamal's Alhambra" is 2002, because its three original 1961
pressings are stored undated. The obvious fix of a second MusicBrainz call
returns the same wrong answer.

Not done on purpose: trav rejected "never propose a shorter title" —
truncating is wanted, since the garbage is usually the part being dropped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NsiFHdyVg1UhBSxDJfTNRm
This commit is contained in:
2026-09-02 17:24:07 -04:00
co-authored by Claude Opus 5
parent f0d4d1eff2
commit 4acc57b648
9 changed files with 674 additions and 36 deletions
+28
View File
@@ -217,6 +217,34 @@ persistence) → GUI (Qt widgets that read the manager and connect to its signal
it never belongs in git). Audio under ~3 s has no fingerprint at all
("Empty fingerprint"), which is a reported failure, not a crash.
- **`lintunes/filename_tags.py`** — the offline half of Identify Track, and the
answer to its biggest limitation: **AcoustID only knows music somebody
submitted**, so an underground/SoundCloud rip fingerprints perfectly and
matches *nothing* (verified: "B. Clem — Zuuso" returns zero results from
AcoustID, zero from a MusicBrainz text search, zero from iTunes). Its
filename, though, says exactly what it is. Pure string work, no network, no
Qt: strips yt-dlp's trailing id (`[1025657891]`, `-WC7gK2kgyTQ` — an 11-char
token is only treated as a YouTube id if it carries a digit, an underscore,
or repeatedly flipping case, or "Underground" would be eaten), drops
`(Official Video)`-style noise, splits `Artist - Title` on a *spaced* hyphen
only (so "Jay-Z" and "350-440-DialTone" survive), collapses a doubled
uploader, reads a leading `1-04`, restores `_s`→`'s`, and falls back to the
iTunes tree (`<root>/Artist/Album/NN Title.ext`), ignoring placeholder dirs
like "Unknown Artist". `fingerprint.candidate_from_filename` wraps it as a
candidate with `source="filename"`, appended to every lookup and standing
alone when there are no matches — the dialog then says where the guess came
from instead of quoting a fabricated confidence. The same filename also
feeds `hint_for(track)`, which ranks real lookup results: token overlap
(words worth double, bare numbers single — "alhambra" identifies a release,
"1961" appears in every compilation spanning it), a coarse **duration**
bucket off the recording lengths AcoustID returns (which is what separates a
150 s studio take from a 155 s live one), and a year named in the filename
that predates anything the database knows. That last one is not a nicety:
MusicBrainz's own `first-release-date` for "Ahmad Jamal's Alhambra" is
**2002**, because its three original 1961 pressings are in the database
undated — so a second MusicBrainz call would return the same wrong year, and
the file's own name is the only place 1961 exists.
- **`lintunes/mpris.py`** — registers `org.mpris.MediaPlayer2.lintunes` over D-Bus
so the desktop's media keys / now-playing popup control playback. Spacebar and
arrow keys are handled locally via `MainWindow.eventFilter`.