From dac33a7688d7e12aff61ad77a793aec4ae980660 Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Sat, 23 Sep 2023 17:17:27 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Add=20missing=20artists=20to=20m?= =?UTF-8?q?b=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media/brainz.go | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/media/brainz.go b/media/brainz.go index d931582..91fe0b0 100644 --- a/media/brainz.go +++ b/media/brainz.go @@ -11,24 +11,47 @@ import ( type MbRecording struct { Id string + Isrcs []string FirstReleaseDate string `json:"first-release-date"` Length int Title string Video bool Releases []MbRelease + Genres []MbGenre +} + +type MbGenre struct { + Id string + Name string } type MbRelease struct { - Id string - Country string - Date string - Media []MbMedia - Status string - StatusId string `json:"status-id"` - Title string + Id string + Country string + Date string + Media []MbMedia + Status string + StatusId string `json:"status-id"` + ArtistCredit []MbArtistCredit `json:"artist-credit"` + Title string + Genres []MbGenre // ReleaseEvents []MbReleaseEvent `json:"release-events"` } +type MbArtistCredit struct { + Name string + Artist MbArtist +} + +type MbArtist struct { + Id string + Name string + TypeId string `json:"type-id"` + Type string + SortName string `json:"sort-name"` + Genres []MbGenre +} + type MbMedia struct { FormatId string `json:"format-id"` Position int @@ -60,7 +83,7 @@ func FillMbRecording(rec *MbRecording) error { } q := req.URL.Query() q.Add("fmt", "json") - q.Add("inc", "releases+media") + q.Add("inc", "releases+media+artist-credits+isrcs+genres") req.URL.RawQuery = q.Encode() req.Header.Set("User-Agent", config.UserAgent)