1 # id3fs - a FUSE-based filesystem for browsing audio metadata
2 # Copyright (C) 2010 Ian Beckwith <ianb@erislabs.net>
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package ID3FS::AudioFile::Flac;
21 use Audio::FLAC::Header;
26 my $class=ref($proto) || $proto;
31 my $flac=Audio::FLAC::Header->new($self->{path});
32 $self->{tags}=$flac->tags();
39 for my $key (keys %{$self->{tags}})
42 defined($self->{tags}->{$key}) &&
43 length($self->{tags}->{$key}) &&
44 $self->{tags}->{$key} =~ /\S+/)
46 return $self->{tags}->{$key};
52 sub artist { shift->get("ARTIST"); }
53 sub album { shift->get("ALBUM"); }
54 sub audiotype { return "flac"; }
55 sub haspic { return undef; } # NEXTVERSION
56 sub v1genre { return undef; } # ID3 only
57 sub year { shift->get("DATE"); }
64 for my $key (keys %{$self->{tags}})
66 if($key =~ /genre/i &&
67 defined($self->{tags}->{$key}) &&
68 length($self->{tags}->{$key}) &&
69 $self->{tags}->{$key} =~ /\S+/)
71 push(@tags, $self->{tags}->{$key});