[scrobbles] Trust webhook POST data and enrich tracks async (db6b05f8)

This commit is contained in:
2026-08-08 20:16:29 -04:00
parent 17706f3f56
commit 5f88d97c69
11 changed files with 597 additions and 89 deletions

View File

@ -1,6 +1,6 @@
#+title: CHANGELOG
* Version 65.0 [5/5]
* Version 65.0 [7/7]
** DONE [#B] Investigate how historice lastfm imports work :importers:music:
:PROPERTIES:
:ID: f91fdd53-9da7-4859-9322-f08b2c587061
@ -145,6 +145,32 @@ scripts with distinct nodenames). Procfile, justfile, Makefile, Drone and
Gitea workflows updated accordingly.
** DONE [#A] Before enriching anything, trust the POST data :feature:scrobbles:metadata:
:PROPERTIES:
:ID: db6b05f8-09f4-49f5-9838-fbacc9fe9cd0
:END:
Jellyfin/Mopidy webhook scrobbles now trust the POST data instead of blocking
on third-party enrichment. `Track.find_or_create(..., trust_webhook_data=True)`
builds tracks purely from webhook data (no MusicBrainz lookups in the request
path), reusing any existing track found by `musicbrainz_id`. Scrobbles built
this way are tagged `webhook-metadata-only` and a background celery task
(`scrobbles.tasks.enrich_media_from_webhook`) enriches them asynchronously from
the payload in `log["raw_data"]`.
The async task runs the newly-implemented `Track.fix_metadata()` (MusicBrainz
resolution, run time, featured artists, album linkage). If resolution matches an
existing track by musicbrainz_id, `Track.merge()` repoints scrobbles/favorites
onto the canonical track and deletes the webhook-created duplicate (skipping
in-progress conflicts). Success tags the scrobble `webhook-enriched`; failure
tags it `enrichment-failed` and logs a warning. Notifications still blast the
raw-data track at scrobble time.
Also fixed a typo in `MOPIDY_POST_KEYS["ARTIST_MB_ID"]`
(`muscibrainz_artist_id` → `musicbrainz_artist_id`). Since enrichment now runs
off the request path, slower subtler matching rules (e.g. a future
`LITERAL_ARTIST_TITLES` exception list) can live in `fix_metadata`.
* Version 64.5 [1/1]
** DONE [#B] Clean up issues with org-mode notes :orgmode:notes:scrobbles:
:PROPERTIES: