+sub opusinfo {
+ my $file = $_[0];
+ my $of = Audio::Opusfile->new_from_file($file);
+ my $tags = $of->tags;
+
+ my %data = (
+ format => 'Opus',
+ title => $tags->query('TITLE'),
+ artist => $tags->query('ARTIST'),
+ year => $tags->query('DATE'),
+ album => $tags->query('ALBUM'),
+ tracknumber => $tags->query('TRACKNUMBER'),
+ tracktotal => $tags->query('TRACKTOTAL'),
+ genre => $tags->query('GENRE'),
+ file => scalar fileparse $file
+ );
+
+ freeze \%data;
+}
+
+my %info = (
+ '.flac' => \&flacinfo,
+ '.mp3' => \&mp3info,
+ '.ogg' => \&vorbisinfo,
+ '.oga' => \&vorbisinfo,
+ '.mp4' => \&mp4info,
+ '.aac' => \&mp4info,
+ '.m4a' => \&mp4info,
+ '.opus' => \&opusinfo,
+);
+