Open bammerlaan opened 5 years ago
Thanks! I can reproduce this, but I'm not sure how to resolve it. The API seems to be rejecting our requests. The request is crafted by musicbrainzngs, which exhibits the same problem if you run its example directly: https://github.com/alastair/python-musicbrainzngs/blob/master/examples/collection.py
I don't see any obvious changes to the MusicBrainz API: https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#collections
We need a volunteer to do some experiments with the MusicBrainz API to see if we can figure out how the request needs to be made.
Are you sure that your collection is of the right type (i.e. a release
collection)? I can reproduce this issue if my collection is of another type (e.g. release-group
), with MusicBrainz API returning this message (alongside a 400);
<?xml version="1.0" encoding="UTF-8"?>
<error>
<text>This is not a collection for entity type release.</text>
<text>For usage, please see: http://musicbrainz.org/development/mmd</text>
</error>
Adding seems to work fine for me when using release
-type collections using the sample code linked above by @sampsyo (I haven't tested beets specifically but looking at our code it acts similarly).
I too am affected by this bug. It appears that mbupdate is trying to update the wrong collection and that this can be fixed by setting the "collection" field in config.yaml
.
Before setting this field, we get:
30204 flac % beet -vvv mbupdate
user configuration: /home/rak/.config/beets/config.yaml
data directory: /home/rak/.config/beets
plugin paths:
Sending event: pluginload
library database: /media/t/music_clean/beetsmusic.blb
library directory: /media/t/music_clean
Sending event: library_opened
mbcollection: Updating MusicBrainz collection cb02bf97-5066-3294-ba3b-ef33dfb244ee...
error: MusicBrainz API error: caused by: HTTP Error 400: Bad Request
Now, looking at the output of the script linked to by @sampsyo , we see that this corresponds to an "events" collection instead of a releases collection:
30014 /tmp % ./collection.py ryanakca
Password for ryanakca:
All collections for this user:
"Attending" by ryanakca (Attending, 0 events)
cb02bf97-5066-3294-ba3b-ef33dfb244ee
"Maybe attending" by ryanakca (Maybe attending, 0 events)
6a6ae86b-a86a-3b85-a511-8428e4b54570
"My Collection" by ryanakca (Release, 262 releases)
d1764520-a53c-4144-a95d-f3c1b43afa07
Adding the ID for "My Collection" to ~/.config/beets/config.yaml
,
mbcollection:
collection: d1764520-a53c-4144-a95d-f3c1b43afa07
then produces the desired behaviour:
30208 flac % beet -vvv mbupdate
user configuration: /home/rak/.config/beets/config.yaml
data directory: /home/rak/.config/beets
plugin paths:
Sending event: pluginload
library database: /media/t/music_clean/beetsmusic.blb
library directory: /media/t/music_clean
Sending event: library_opened
mbcollection: Updating MusicBrainz collection d1764520-a53c-4144-a95d-f3c1b43afa07...
mbcollection: ...MusicBrainz collection updated.
Sending event: cli_exit
So it looks like beets needs to properly determine the default collection for releases and not just pick the first available collection in the list.
Aha; that makes sense! Looks like we need to add something to scan over all the collections to find the first release-type collection.
Was this ever resolved?
Problem
Hey, I was trying to add my music collection to Musicbrainz, but got the following error:
error: MusicBrainz API error: caused by: HTTP Error 400: Bad Request
Looks similar to this earlier bug report: https://github.com/beetbox/beets/issues/1152
Running this command in verbose (
-vv
) mode:Setup
My configuration (output of
beet config
) is: