From 8c158a921aff8fb9bfb884ad622cb0385acf622a Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Fri, 22 Jul 2016 23:36:45 -0400 Subject: [PATCH] Bad implementation of opus (calls opusinfo) --- MANIFEST | 1 + empty2.opus | Bin 0 -> 1808 bytes lib/App/MusicExpo.pm | 26 ++++++++++++++++++++++++++ t/musicexpo-cache.t | 3 ++- t/musicexpo.t | 2 +- 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 empty2.opus 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 0000000000000000000000000000000000000000..88438ad71b4141bd1160058d866b508a4c27fc31 GIT binary patch literal 1808 zcmeZIPY-5bVt@kw3oIERX3CnB8;rvK1*OFvsfj6!Oeu^mYrsnULCWC(q?{4RTQ%X% z66XK^|A91wB&HX01I2POlk$OF1w%bUP9Rqmh+X}h{asvxY(e6wdC3ZCMftf3AdYTH zetu4|f`Oi)o+U3(VTfmlkE^Y7YEDjRPAVTzz%eMqGdRRHI5P*RFI5;M;^P$Riz+M% z6SnnHPb@7dN>xbBODW3FECJc?;uzv;Yh++x3NkJv$kEx`FVxow=okY-u#F&*5dRQI zA6o;k6Wm?>f?RD~b5fH_it>S4M!{$Z;0*zA&R}`M3{eEi8K7KsKB$q0<^TQvr~lM1 zyu=f%z_4b^DbY()rp7NZ@@DN632oTBao5Z#yM9_U_DuQH@;(YmEon8^JD1P=V$GzZKSt8rL6oUxm?>UW!>}FZBSZ{keJD6t=UO(fLP=A_nbm(E4hFOIMg4qY*Gfs+6Ca4nk+vwq%kW;mw) z+icnz@9#TAdw6$03}514`)L82g4nvkMRWehi~dOcQ~TI@>4wOQOMlLm@cEcupWbb& zRkEU1V~y9>uP5#s&#qbh^y!Q|@PVw^=-F5EEglBsYBS{cH*B|_@H3u|buTE$F9>;GoYX8KNNnW|ae_oY1L zK>w@%GKm=*nD!;_-T6UQ)KnqkrHlXM2QL1{GnkhM*t=hT;B6LV_)orkvxD6MeDO=B zoS5az=zLkbWCwkn5J8cTjFEYq?f*|2eg0Ln?-B1R<0pm6FYeFV{W!lwQeErVwM64T z%|G?e@4KcWbFt&|zm=6|xm4`W%;A2g?qN2u{s@bw&|9gA^*gLLJ3TlxXWNQfaa^HC z&D%F|v+kM@UnN{!SRNrP0CFg^luh_M1qKGLzlZ;QR?TgYsc`l@?Wa<4T>1W{#o`+} Pz8v-Zb+f)q*<2q0vrOLP literal 0 HcmV?d00001 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; -- 2.39.2