Question

I am struggling for a couple of hours now on how to link a discid to a musicbrainz mbid.

So, using dietmar-steiner / JMBDiscId

JMBDiscId discId = new JMBDiscId();

if (discId.init(PropertyFinder.getProperty("libdiscid.path")))
{
    String musicBrainzDiscID = discId.getDiscId(PropertyFinder.getProperty("cdrom.path"));
}

or musicbrainzws2-java

Disc controller = new Disc();
String drive = PropertyFinder.getProperty("cdrom.path"); 

try {
    DiscWs2 disc =controller.lookUp(drive);
    log.info("DISC: " + disc.getDiscId() + " match: " + disc.getReleases().size() + " releases");
....

I can extract a discid for freedb or musicbrainz easily (more or less), but I have not found a way on calculating the id I that I need to download cover art via the CoverArtArchiveClient from last.fm.

CoverArtArchiveClient client = new DefaultCoverArtArchiveClient();

try
{
  UUID mbid = UUID.fromString("mbid to locate release");
  fm.last.musicbrainz.coverart.CoverArt coverArt = client.getByMbid(mbid);

Theoretically, I assume, I could you the data collected by musicbrainzws2-java to trigger a search, and then use the mbid from the result ... but that cannot be the best option to do.

I am happy about any push into the right direction...

Cheers, Ed.

No correct solution

OTHER TIPS

You don't calculate the MBID. The MBID is attached on every entity you retrieve from MusicBrainz. When getting releases by DiscID you get a list. Each entry is a release and has an MBID, accessible with getId():

for (ReleaseWs2 rel : disc.getReleases()){
   log.info("MBID: " + rel.getId() + ", String: " + rel.toString());
}

You then probably want to try the CoverArtArchive (CAA) for every release and take the first cover art you get.

Unfortunately I don't know of any API documentation for musicbrainzws2 on the web. I recommend running javadoc on all source files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top