1 package ID3FS::File::Ogg;
5 use Ogg::Vorbis::Header;
10 my $class=ref($proto) || $proto;
15 $self->{ogg}=Ogg::Vorbis::Header->new($self->{path});
21 my ($self, $tag, $verbose)=@_;
22 my @comments=$self->{ogg}->comment($tag);
25 # take first comment with actual contents
26 while(my $comment=shift @comments)
28 if(defined($comment) &&
32 $comment =~ s/\//-/g; # drop slashes
37 warn("$self->{path}: no $tag defined in Ogg comments\n") if($verbose);
41 sub artist { shift->get("Artist", 1); }
42 sub album { shift->get("Album", 1); }
43 sub audiotype { return "ogg"; }
44 sub haspic { return undef; } # FIXME
45 sub v1genre { return undef; } # ID3 only
47 # We don't care if year is not set
51 my $date=shift->get("Date", 0);
52 return undef unless($date);
53 if($date =~/(\d\d\d\d)/)
63 my @comments=$self->{ogg}->comment("Genre");
67 # filter for useful comments
68 @comments= grep { defined($_); } @comments;
69 @comments= grep { length($_); } @comments;
70 @comments= grep { /\S+/; } @comments;
71 for my $comment (@comments)
73 if($comment=~/([^\/]+)\/(.*)/)
78 $tags->{$tagname}=$tagval;
82 $tags->{$comment}=undef;