Last change
on this file since 46 was
40,
checked in by peter, 10 years ago
|
If given a barcode, get_musicbrainz_info() will attempt to match a release on
the DiscID and the barcode.
- get_musicbrainz_info() and select_release() take a hashref with
discid and barcode keys
- mbz script takes a --barcode argument; however, if --flac is given,
it dtermines the barcode from the BARCODE tag in the FLAC file
- added a barcode method to the DiscFlacFile class
- corrected the call to Audio::FLAC::Header::info to a call to tags for
the Vorbis tags
- removed the superfluous getprops script
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/usr/bin/perl -w |
---|
2 | use strict; |
---|
3 | |
---|
4 | # one use case: for f in ~/cds/*.flac; do mbid=`./mbz --flac $f --get-release-id`; echo $f $mbid; done; |
---|
5 | |
---|
6 | use FindBin; |
---|
7 | use lib "$FindBin::RealBin/lib"; |
---|
8 | |
---|
9 | use Getopt::Long; |
---|
10 | use MusicBrainz; |
---|
11 | use DiscFlacFile; |
---|
12 | |
---|
13 | GetOptions( |
---|
14 | 'flac=s' => \my $FLAC_FILE, |
---|
15 | 'barcode=s' => \my $BARCODE, |
---|
16 | 'get-release-id' => \my $GET_RELEASE_ID, |
---|
17 | 'xml' => \my $GET_XML, |
---|
18 | ); |
---|
19 | |
---|
20 | my $discid; |
---|
21 | my $barcode; |
---|
22 | |
---|
23 | if ($FLAC_FILE) { |
---|
24 | my $flac_disc = DiscFlacFile->new({ file => $FLAC_FILE }); |
---|
25 | $discid = $flac_disc->discid; |
---|
26 | $barcode = $flac_disc->barcode; |
---|
27 | } else { |
---|
28 | $discid = shift; |
---|
29 | $barcode = $BARCODE; |
---|
30 | } |
---|
31 | |
---|
32 | # make the output terminal handle UTF-8 characters |
---|
33 | binmode STDOUT, ':utf8'; |
---|
34 | |
---|
35 | # just dump the XML, if requested |
---|
36 | if ($GET_XML) { |
---|
37 | print lookup_release($discid); |
---|
38 | exit; |
---|
39 | } |
---|
40 | |
---|
41 | # otherwise, do the full parsing of the data |
---|
42 | my $info = get_musicbrainz_info({ |
---|
43 | discid => $discid, |
---|
44 | barcode => $barcode, |
---|
45 | }); |
---|
46 | |
---|
47 | exit unless $info; |
---|
48 | |
---|
49 | if ($GET_RELEASE_ID) { |
---|
50 | print "$$info{MUSICBRAINZ_ALBUMID}\n"; |
---|
51 | } else { |
---|
52 | for my $key (sort keys %{ $info }) { |
---|
53 | print "$key=$$info{$key}\n"; |
---|
54 | } |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.