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});
18 print Dumper $self->{ogg}->comment_tags;
24 my ($self, $tag, $verbose)=@_;
25 my @comments=$self->{ogg}->comment($tag);
28 # take first comment with actual contents
29 while(my $comment=shift @comments)
31 if(defined($comment) &&
35 $comment =~ s/\//-/g; # drop slashes
40 warn("$self->{path}: no $tag defined in Ogg comments\n") if($verbose);
44 sub artist { shift->get("Artist", 1); }
45 sub album { shift->get("Album", 1); }
46 sub audiotype { return "ogg"; }
47 sub haspic { return undef; } # FIXME
48 sub v1genre { return undef; } # ID3 only
50 # We don't care if year is not set
54 my $date=shift->get("Date", 0);
55 return undef unless($date);
56 if($date =~/(\d\d\d\d)/)
66 my @comments=$self->{ogg}->comment("Genre");
70 # filter for useful comments
71 @comments= grep { defined($_); } @comments;
72 @comments= grep { length($_); } @comments;
73 @comments= grep { /\S+/; } @comments;
74 for my $comment (@comments)
76 if($comment=~/([^\/]+)\/(.*)/)
81 $tags->{$tagname}=$tagval;
85 $tags->{$comment}=undef;