Last change
on this file since 8 was
8,
checked in by peter, 11 years ago
|
- use the VorbisComment style tag names in the info hash returned by MusicBrainz::get_musicbrainz_info()
- use the MusicBrainz name credit join phrase to build the string where there are multiple artists
- include the artist sort names in the returned info, as TRACKnn.ARTISTSORT keys, and ALBUMARTIST
- added an applymeta script that applies the metadata listed in a file to a set of MP3 files
- when loooking up a release, MusicBrainz::get_musicbrainz_info() prints the number of releases and some other debugging info to STDERR
|
-
Property svn:executable set to
*
|
File size:
1.0 KB
|
Rev | Line | |
---|
[1] | 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 Getopt::Long; |
---|
[3] | 7 | use MusicBrainz; |
---|
[1] | 8 | |
---|
| 9 | GetOptions( |
---|
| 10 | 'flac=s' =>\my $FLAC_FILE, |
---|
| 11 | 'get-release-id' => \my $GET_RELEASE_ID, |
---|
| 12 | 'xml' =>\my $GET_XML, |
---|
| 13 | ); |
---|
| 14 | |
---|
| 15 | my $discid; |
---|
| 16 | |
---|
| 17 | if ($FLAC_FILE) { |
---|
| 18 | require Audio::FLAC::Header; |
---|
| 19 | my $flac = Audio::FLAC::Header->new($FLAC_FILE) or die "Can't read FLAC header from $FLAC_FILE\n"; |
---|
| 20 | $discid = $flac->tags('MBZ_DISCID') or die "No MBZ_DISCID tag in $FLAC_FILE\n"; |
---|
| 21 | } else { |
---|
| 22 | $discid = shift; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | # make the output terminal handle UTF-8 characters |
---|
| 26 | binmode STDOUT, ':utf8'; |
---|
| 27 | |
---|
[3] | 28 | # just dump the XML, if requested |
---|
| 29 | if ($GET_XML) { |
---|
| 30 | print lookup_release($discid); |
---|
| 31 | exit; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | # otherwise, do the full parsing of the data |
---|
[1] | 35 | my $info = get_musicbrainz_info($discid); |
---|
| 36 | |
---|
| 37 | exit unless $info; |
---|
| 38 | |
---|
| 39 | if ($GET_RELEASE_ID) { |
---|
[8] | 40 | print "$$info{MUSICBRAINZ_ALBUMID}\n"; |
---|
[1] | 41 | } else { |
---|
| 42 | for my $key (sort keys %{ $info }) { |
---|
[5] | 43 | print "$key=$$info{$key}\n" unless ref $info->{$key}; |
---|
[1] | 44 | } |
---|
| 45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.