use MP3::Info qw/get_mp3tag/;
use Ogg::Vorbis::Header::PurePerl;
use MP4::Info qw/get_mp4tag get_mp4info/;
+use Audio::Opusfile qw//;
use DB_File qw//;
use Encode qw/encode/;
sub opusinfo {
my $file = $_[0];
- my %info;
- my @info = `opusinfo \Q$file`;
- return unless @info;
- for (@info) {
- chomp;
- $info{$1} = $2 if /\s*([A-Z]+)=(.*)$/;
- }
+ my $of = Audio::Opusfile->new_from_file($file);
+ my $tags = $of->tags;
my %data = (
format => 'Opus',
- title => $info{TITLE},
- artist => $info{ARTIST},
- year => $info{DATE},
- album => $info{ALBUM},
- tracknumber => $info{TRACKNUMBER},
- tracktotal => $info{TRACKTOTAL},
- genre => $info{GENRE},
+ 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
);