Now let us see how to search the MusicBrainz Database using DiscID. “discid” is one of the non-core entities in MusicBrainz but still it is very important. DiscID for any Compact Disc is generated with the help of libdiscid. This discid will be searched using libmusicbrainz5 to get the metadata associated with the discid. Here’s the code for this tutorial.
Using libdiscid is simple. Here’s the API Reference of libdiscid.
Functions which are of prime importance here are
1. DiscId* discid_new();
This function creates a new object of DiscId.
2. char * discid_get_default_device (void)
This function returns the default device to be used by libdiscid.
3. int discid_read(DiscId* d,const char* device)
This function reads the disc inserted into the device. If device is NULL, then default device is used. It returns true (value greater than 0) if successful or false(0) if not.
4. char * discid_get_id (DiscId *d)
This function returns the discid of the disc referred by d.
The above functions are used as in the code to determine the discid and use it to search.
You should pass, “discid” and discid in mb5_query_query() function as shown in the code.
Everything else is same. Try on your own 🙂