source: flacrip/trunk/lib/DiscFlacFile.pm @ 47

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