X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FMusicExpo.pm;h=5dd41b60f02819ef2def84562dd77c86348f9b35;hb=8c158a921aff8fb9bfb884ad622cb0385acf622a;hp=cf16468be168d69498b4ead9bec69d2a2b308925;hpb=a5dd5c0dee4a02197fe6e9bc36424d2befdfb816;p=app-musicexpo.git diff --git a/lib/App/MusicExpo.pm b/lib/App/MusicExpo.pm index cf16468..5dd41b6 100644 --- a/lib/App/MusicExpo.pm +++ b/lib/App/MusicExpo.pm @@ -3,7 +3,7 @@ use 5.014000; use strict; use warnings; -our $VERSION = '0.006'; +our $VERSION = '1.000'; use Audio::FLAC::Header qw//; use HTML::Template::Compiled qw//; @@ -111,6 +111,31 @@ sub mp4info{ }; } +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 %data = ( + format => 'Opus', + title => $info{TITLE}, + artist => $info{ARTIST}, + year => $info{DATE}, + album => $info{ALBUM}, + tracknumber => $info{TRACKNUMBER}, + tracktotal => $info{TRACKTOTAL}, + genre => $info{GENRE}, + file => scalar fileparse $file + ); + + freeze \%data; +} + my %info = ( '.flac' => \&flacinfo, '.mp3' => \&mp3info, @@ -119,6 +144,7 @@ my %info = ( '.mp4' => \&mp4info, '.aac' => \&mp4info, '.m4a' => \&mp4info, + '.opus' => \&opusinfo, ); sub normalizer{ @@ -237,7 +263,7 @@ Marius Gavrilescu, Emarius@ieval.roE =head1 COPYRIGHT AND LICENSE -Copyright (C) 2013-2015 by Marius Gavrilescu +Copyright (C) 2013-2016 by Marius Gavrilescu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or,