Last change
on this file since 35 was
32,
checked in by peter, 10 years ago
|
- added the DiscFlacFile class
|
File size:
740 bytes
|
Line | |
---|
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; |
---|
38 | return $self->flac->info('MUSICBRAINZ_DISCID') || $self->tracks->discid; |
---|
39 | } |
---|
40 | |
---|
41 | # module return |
---|
42 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.