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::Ogg;
21 use Ogg::Vorbis::Header;
26 my $class=ref($proto) || $proto;
31 $self->{ogg}=Ogg::Vorbis::Header->new($self->{path});
32 $self->{comments}=[ $self->{ogg}->comment_tags() ];
39 for my $commenttype (@{$self->{comments}})
41 if($commenttype =~ /$tag/i)
43 my @comments=$self->{ogg}->comment($commenttype);
46 # take first comment with actual contents
47 while(my $comment=shift @comments)
49 if(defined($comment) &&
53 $comment =~ s/\//-/g; # drop slashes
63 sub artist { shift->get("Artist"); }
64 sub album { shift->get("Album"); }
65 sub audiotype { return "ogg"; }
66 sub haspic { return undef; } # NEXTVERSION
67 sub v1genre { return undef; } # ID3 only
68 sub year { shift->get("Date"); }
74 for my $commenttype (@{$self->{comments}})
76 if($commenttype =~ /genre/i)
78 push(@comments,$self->{ogg}->comment($commenttype));