From b8fe82ed92eb6f385a4b15c3df817259ca1eb1d0 Mon Sep 17 00:00:00 2001 From: Inrixia Date: Wed, 9 Oct 2024 19:27:21 +1300 Subject: [PATCH] lib.ExtendedTrackItem - fix recording not set on releaseTrack --- plugins/_lib/Caches/ExtendedTrackItem.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/_lib/Caches/ExtendedTrackItem.ts b/plugins/_lib/Caches/ExtendedTrackItem.ts index 4fe5ca05..0a8e11e9 100644 --- a/plugins/_lib/Caches/ExtendedTrackItem.ts +++ b/plugins/_lib/Caches/ExtendedTrackItem.ts @@ -60,18 +60,20 @@ export class ExtendedMediaItem { if (this.tidalTrack.isrc !== undefined) { // Lookup the recording from MusicBrainz by ISRC - const recording = await requestJsonCached<{ recordings: IRecording[] }>(`https://musicbrainz.org/ws/2/isrc/${this.tidalTrack.isrc}?fmt=json`) + const recording = await requestJsonCached<{ recordings: IRecording[] }>(`https://musicbrainz.org/ws/2/isrc/${this.tidalTrack.isrc}?inc=isrcs&fmt=json`) .then(({ recordings }) => recordings[0]) .catch(libTrace.warn.withContext("MusicBrainz.getISRCRecordings")); if (recording !== undefined) { // If a recording exists then fetch the full recording details including media for title resolution - const release = await requestJsonCached(`https://musicbrainz.org/ws/2/recording/${recording.id}?inc=releases+media+artist-credits&fmt=json`) + const release = await requestJsonCached(`https://musicbrainz.org/ws/2/recording/${recording.id}?inc=releases+media+artist-credits+isrcs&fmt=json`) .then(({ releases }) => releases?.filter((release) => release.country === "XW")[0] ?? releases?.[0]) .catch(libTrace.warn.withContext("MusicBrainz.getISRCRecordings")); if (release === undefined) return undefined; - return (this._releaseTrack = release.media?.[0].tracks?.[0]); + this._releaseTrack = release.media?.[0].tracks?.[0]; + this._releaseTrack.recording = recording; + return this._releaseTrack; } }