]> iEval git - app-musicexpo.git/commitdiff
Bad implementation of opus (calls opusinfo)
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 23 Jul 2016 03:36:45 +0000 (23:36 -0400)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 23 Jul 2016 03:36:45 +0000 (23:36 -0400)
MANIFEST
empty2.opus [new file with mode: 0644]
lib/App/MusicExpo.pm
t/musicexpo-cache.t
t/musicexpo.t

index 38903755f632743bf1b65ec8ac10ee5a25f47f21..28c52ad298dfdaf04dcf87e7e5cb0da6c59beb65 100644 (file)
--- 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 (file)
index 0000000..88438ad
Binary files /dev/null and b/empty2.opus differ
index 5b66bab875a222b234086ec0636b3f3d0c5991bc..5dd41b60f02819ef2def84562dd77c86348f9b35 100644 (file)
@@ -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{
index 81016c54d7d4f621bc1b4ac8300271e94c265760..47e07c9069d1ce93beb9eb31c624120a9dfb317c 100644 (file)
@@ -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';
 <tr><th>Title<th>Artist<th>Album<th>Genre<th>Track<th>Year<th>Type
 <tbody>
 <tr><td class="title"><a href="#silence-cellule" data-hash="#silence-cellule">Cellule</a><td class="artist">Silence<td class="album">L&#39;autre endroit<td class="genre">Electro<td class="track">01/09<td class="year">2005<td class="formats"><a href="/music/empty.flac">FLAC</a> <a href="/music/empty.ogg">Vorbis</a> 
+<tr><td class="title"><a href="#silence-cellule" data-hash="#silence-cellule">Cellule</a><td class="artist">Silence<td class="album">L&#39;autre endroit<td class="genre">Electro<td class="track">01/09<td class="year">2005<td class="formats"><a href="/music/empty2.opus">Opus</a> 
 <tr><td class="title"><a href="#silence-cellule" data-hash="#silence-cellule">Cellule</a><td class="artist">Silence<td class="album">L&#39;autre endroit<td class="genre">Electro<td class="track">01/09<td class="year">2005<td class="formats"><a href="/music/empty3.mp3">MP3</a> 
 <tr><td class="title"><a href="#silence-cellule" data-hash="#silence-cellule">Cellule</a><td class="artist">Silence<td class="album">L&#39;autre endroit<td class="genre">Electro<td class="track">1/9<td class="year">2005<td class="formats"><a href="/music/empty4.aac">AAC</a> 
 </table>
index 550c5745cab34eb7531cefdcbacb789a8a2fa1d3..82fcabbeb3d14ac5c5b698a55d12c5855c96bcac 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -wT
+#!/usr/bin/perl -w
 use v5.14;
 use warnings;
 
This page took 0.023999 seconds and 4 git commands to generate.