From: Marius Gavrilescu Date: Sat, 23 Jul 2016 03:36:45 +0000 (-0400) Subject: Bad implementation of opus (calls opusinfo) X-Git-Tag: 1.001_000~1 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=8c158a921aff8fb9bfb884ad622cb0385acf622a;p=app-musicexpo.git Bad implementation of opus (calls opusinfo) --- diff --git a/MANIFEST b/MANIFEST index 3890375..28c52ad 100644 --- a/MANIFEST +++ b/MANIFEST @@ -12,6 +12,7 @@ musicexpo musicexpo.css empty.flac empty.ogg +empty2.opus empty3.mp3 empty4.aac player.js diff --git a/empty2.opus b/empty2.opus new file mode 100644 index 0000000..88438ad Binary files /dev/null and b/empty2.opus differ diff --git a/lib/App/MusicExpo.pm b/lib/App/MusicExpo.pm index 5b66bab..5dd41b6 100644 --- a/lib/App/MusicExpo.pm +++ b/lib/App/MusicExpo.pm @@ -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{ diff --git a/t/musicexpo-cache.t b/t/musicexpo-cache.t index 81016c5..47e07c9 100644 --- a/t/musicexpo-cache.t +++ b/t/musicexpo-cache.t @@ -1,4 +1,4 @@ -#!/usr/bin/perl -wT +#!/usr/bin/perl -w use v5.14; use warnings; @@ -34,6 +34,7 @@ is $out, <<'OUT', 'output is correct'; TitleArtistAlbumGenreTrackYearType CelluleSilenceL'autre endroitElectro01/092005FLAC Vorbis +CelluleSilenceL'autre endroitElectro01/092005Opus CelluleSilenceL'autre endroitElectro01/092005MP3 CelluleSilenceL'autre endroitElectro1/92005AAC diff --git a/t/musicexpo.t b/t/musicexpo.t index 550c574..82fcabb 100644 --- a/t/musicexpo.t +++ b/t/musicexpo.t @@ -1,4 +1,4 @@ -#!/usr/bin/perl -wT +#!/usr/bin/perl -w use v5.14; use warnings;