Skip to content

fix(art): take track ID from match info instead of item mb_trackid#39

Merged
Samik081 merged 1 commit into
mainfrom
fix/art-track-id-from-match
Jul 9, 2026
Merged

fix(art): take track ID from match info instead of item mb_trackid#39
Samik081 merged 1 commit into
mainfrom
fix/art-track-id-from-match

Conversation

@Samik081

@Samik081 Samik081 commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #38 — album art was not embedded and the import log showed:

beatport4: Failed to fetch track : Error 404 for '/v4/catalog/tracks//'
beatport4: No image data for track ; skipping

Root cause

The import_task_files art hook read the Beatport track ID from items[0].get("mb_trackid"). Other plugins can blank that field on the shared in-memory Item objects before the hook runs — notably zero configured with mb_trackid in its fields and update_database: true, whose write listener sets item[field] = None during the import write phase. The hook then requested /v4/catalog/tracks// (empty ID), got a 404, and skipped art embedding. Reproduced exactly with zero + scrub enabled on both fresh imports and -L re-imports.

Fix

Take the track ID from task.match.info — data the plugin itself produced — instead of the mutable library item:

  • AlbumInfo matches: first track with a track_id (all tracks on a release share the same cover art)
  • singleton TrackInfo matches: info.track_id
  • no ID in the match: skip with a debug log instead of firing a bogus request

Testing

  • 3 new regression tests (blanked mb_trackid, singleton path, match without track IDs); full suite passes 140/140
  • Verified end-to-end against the live Beatport API in an isolated BEETSDIR with zero (mb_trackid zeroed, update_database: true) + scrub enabled: re-import of the reporter's release (4194963) fetches and embeds art in all 4 files; singleton import path verified as well

The import_task_files art hook read the Beatport track ID from
items[0].mb_trackid. Other plugins can blank that field on the
shared in-memory Item before the hook runs — notably zero with
mb_trackid in its fields and update_database: true, whose write
listener sets item[field] = None during the import write phase.
The hook then requested '/v4/catalog/tracks//', got a 404 and
skipped art embedding.

Source the ID from task.match.info instead: first track with an ID
for AlbumInfo matches, track_id for singleton TrackInfo matches,
and skip with a debug log when the match carries no ID.

Fixes #38
@Samik081
Samik081 force-pushed the fix/art-track-id-from-match branch from f989df7 to 34c7ad8 Compare July 9, 2026 21:29
@Samik081 Samik081 mentioned this pull request Jul 9, 2026
3 tasks
@Samik081
Samik081 merged commit 48e7dce into main Jul 9, 2026
12 checks passed
@Samik081
Samik081 deleted the fix/art-track-id-from-match branch July 9, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not getting album art

1 participant