#1 2011-01-08 19:46:32

unclepetros
Member
Registered: 2010-04-11
Posts: 88

[HowTo] Compile Musicbrainz-DiscID module

Hi,
I've found a very good library for retrieving audio disc info, indipendently from the specific Operating System used.
It's the Musicbrainz-DiscID perl module, available here: http://search.cpan.org/dist/MusicBrainz-DiscID/ .
It's a perl binding of the libdiscid library, available here: http://musicbrainz.org/doc/libdiscid .

This library is very simple to use and integrate in a running project (GCStar, in our case).

Unfortunately I could not find precompiled binaries for the 0.2.2 version of the libdiscid library, and for the Musicbrainz-DiscID perl module; so I had to compile them manually.

I want to share with you all the steps done in order to compile and run successfully the module, both under Windows and GNU/Linux (Ubuntu).

Obviously, as a prerequisite, you need a perl development environment, that is a perl SDK, and all the module dependencies required by GCStar (see the windows section of this [HowTo] for more detailed instructions)

Under Windows

1. First of all, we need to compile the version 0.2.2 of the libdiscid library, required by the Musicbrainz-DiscID module.
This is not so easy because of two bugs I've found in the Makefile of the library; I had to use a few workarounds to ends compile succesfully.
Anyhow, you don't need to compile it again; I've done it for you.
In the attachment the precompiled binaries (I've send a copy also to the Musicbrainz team).

2. So, download the attachment libdiscid_0.2.2_win32bin.zip and uncompress it a folder (c:\ is ok).

3. Now, download the Test::Pod module, required by the Musicbrainz-DiscID module, from here: http://search.cpan.org/CPAN/authors/id/ … .44.tar.gz .

4. Uncompress it, open command prompt and install it with the following commands:

Code:

perl Makefile.pl
dmake
dmake test
dmake install

5. If not yet present, create PKG_CONFIG_PATH environment variable and set it with the path of the pkg-config folder of the libdiscid library (should be c:\libdiscid\lib\pkgconfig).

6. Now, download Musicbrainz-DiscID sources from here and uncompress it in a folder.

7. Open command promt and go to the Musicbrainz-DiscID folder just uncompressed.

8. Enter the following command to start installation:

Code:

perl Build.pl

If the command ended successfully you should see a new file, Build.bat.

9. Finish installation by entering the following commands, one by one:

Code:

Build
Build test
Build install

If all goes fine, you should have Musicbrainz-DiscID module installed on your system.

10. Before trying the library, you must set in the PATH environment variable the path of the libdiscid.dll library (should be c:\libdiscid\bin)

11. Now you can try the library by running this example perl script:

Code:

 use MusicBrainz::DiscID;
  my $discid = MusicBrainz::DiscID->new('F:');
  if ( $discid->read() == 0 ) {
      print STDERR "Error: " . $discid->error_msg() . "\n";
      exit(1);
  }
  print "DiscID: " . $discid->freedb_id() . "\n";

Replace 'F:' with your cdrom drive letter.

Under Ubuntu

1. Install libdiscid with the following command:

Code:

sudo apt-get install libdiscid0

2. Install the Test::Pod module, required by the Musicbrainz-DiscID module, with the following command:

Code:

sudo apt-get install libtest-pod-perl

3. Install the Musicbrainz-DiscID module with the following command:

Code:

sudo apt-get install libmusicbrainz-discid-perl

NOTE: this precompiled package is available only for Maverick (10.10) and Natty (11.04) Ubuntu version.
If you have a previous ubuntu versions (i.e. Lucid or Karmic) you can try to download the package from here and install it with the following command:

Code:

sudo dpkg -i --force-depends libmusicbrainz-discid-perl_0.03-1_<your_arch>.deb

4. Now you can try the library by running this example perl script:

Code:

 use MusicBrainz::DiscID;
  my $discid = MusicBrainz::DiscID->new('/dev/cdrom');
  if ( $discid->read() == 0 ) {
      print STDERR "Error: " . $discid->error_msg() . "\n";
      exit(1);
  }
  print "DiscID: " . $discid->freedb_id() . "\n";

Replace '/dev/cdrom' with your cdrom drive path.

Regards
UnclePetros


Attachments:
Attachment Icon libdiscid_0.2.2_win32bin.zip, Size: 344,517 bytes, Downloads: 376

Offline

 



Should you have a problem using GCstar, you can open a bug report or request some support on GCstar forums.