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
|
File size:
820 bytes
|
Rev | Line | |
---|
[32] | 1 | package DiscFlacFile; |
---|
| 2 | |
---|
| 3 | use Moose; |
---|
| 4 | |
---|
| 5 | use Audio::FLAC::Header; |
---|
| 6 | use Tracks; |
---|
| 7 | |
---|
| 8 | has file => ( |
---|
| 9 | is => 'ro', |
---|
| 10 | isa => 'Str', |
---|
| 11 | ); |
---|
| 12 | has flac => ( |
---|
| 13 | is => 'ro', |
---|
| 14 | isa => 'Audio::FLAC::Header', |
---|
| 15 | builder => '_load_flac', |
---|
| 16 | lazy => 1, |
---|
| 17 | init_arg => undef, |
---|
| 18 | ); |
---|
| 19 | has tracks => ( |
---|
| 20 | is => 'ro', |
---|
| 21 | isa => 'Tracks', |
---|
| 22 | builder => '_load_tracks', |
---|
| 23 | lazy => 1, |
---|
| 24 | init_arg => undef, |
---|
| 25 | ); |
---|
| 26 | |
---|
| 27 | sub _load_flac { Audio::FLAC::Header->new($_[0]->file) } |
---|
| 28 | |
---|
| 29 | sub _load_tracks { |
---|
| 30 | my $self = shift; |
---|
| 31 | my $tracks = Tracks->new; |
---|
| 32 | $tracks->read_flac($self->flac); |
---|
| 33 | return $tracks; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | sub discid { |
---|
| 37 | my $self = shift; |
---|
[40] | 38 | return $self->flac->tags('MUSICBRAINZ_DISCID') || $self->tracks->discid; |
---|
[32] | 39 | } |
---|
| 40 | |
---|
[40] | 41 | sub barcode { |
---|
| 42 | my $self = shift; |
---|
| 43 | return $self->flac->tags('BARCODE'); |
---|
| 44 | } |
---|
| 45 | |
---|
[32] | 46 | # module return |
---|
| 47 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.