1 package ID3FS::AudioFile::Mp3;
10 my $class=ref($proto) || $proto;
15 $self->{mp3}=MP3::Tag->new($self->{path});
18 $self->{v1}=$self->{mp3}->{ID3v1} if(exists($self->{mp3}->{ID3v1}));
20 $self->{v2}=$self->{mp3}->{ID3v2} if(exists($self->{mp3}->{ID3v2}));
31 if(defined($self->{v2}))
33 $thing=$self->{v2}->$func();
35 if(defined($self->{v1}) && (!defined($thing) || !length($thing)))
37 $thing=$self->{v1}->$func();
42 sub artist { shift->choose("artist"); }
43 sub album { shift->choose("album"); }
44 # We don't care if year is not set
45 sub year { shift->choose("year"); }
46 sub audiotype { return "mp3"; }
47 sub haspic { return undef; } # FIXME
52 $genre=$self->{v1}->genre() if(defined($self->{v1}));
59 return() unless(exists($self->{mp3}->{ID3v2}) && defined($self->{mp3}->{ID3v2}));
60 return($self->{mp3}->{ID3v2}->genre());
66 # MP3::Tag->get_tags shows cryptic debug info via print when it finds
67 # an unhandled id3v2 version, in addition to the warning, so use
68 # select to send prints to /dev/null
70 if(open(NULL,">/dev/null"))
74 eval { $self->{mp3}->get_tags; };
75 warn("$self->{path}: $@\n") if($@);