Max icon indicating copy to clipboard operation
Max copied to clipboard

Empty array returned from MusicBrainz query if JSON key "releases" is missing.

Open SWalkerTTU opened this issue 5 years ago • 1 comments

Performing this query:

http://musicbrainz.org/ws/2/discid/CPuVKAnEu8JT0qUWkzcdMV7wHXA-?inc=artists+labels+recordings+release-groups+artist-credits&fmt=json

with Google Chrome resulted in this:

{ "id":"CPuVKAnEu8JT0qUWkzcdMV7wHXA-", "track-count":12, "artist":"Sleeper", "barcode":"0078221882422", "tracks":[{"title":"Feeling Peaky","length":173293,"artist":null},{"length":269973,"title":"Sale of the Century","artist":null},{"artist":null,"title":"Dress Like Your Mother","length":153000},{"title":"Statuesque","length":203560,"artist":null},{"artist":null,"title":"Nice Guy Eddie","length":200600},{"artist":null,"title":"Stop Your Crying","length":215906},{"title":"Lie Detector","length":152093,"artist":null},{"artist":null,"length":221800,"title":"What Do I Do Now?"},{"title":"Shrinkwrapped","length":286440,"artist":null},{"artist":null,"title":"Good Luck Mr. Gorsky","length":245733},{"artist":null,"title":"Factor 41","length":177333},{"artist":null,"length":172933,"title":"Click...off...gone"}], "disambiguation":"", "title":"The it Girl" }

As there is no "releases" key in this result, PerformMusicBrainzQuery returns an empty array. The lack of a "releases" key is likely due to changes on the MusicBrainz server.

SWalkerTTU avatar Jun 20 '20 01:06 SWalkerTTU

Apparently that entry is a CD stub, "an anonymously submitted track list that contains a disc ID, barcode, comment field, and basic metadata like a release title and track names."

There are two options I can see to handle this case:

  1. Add cdstubs=no to the query string to suppress cd stubs.
  2. Attempt to parse cd stub data in absence of a release.

The best option is probably 2 but I'll need to investigate whether creating a phony release with the cd stub data works with the current MB code.

sbooth avatar Sep 15 '20 19:09 sbooth