Bad implementation of opus (calls opusinfo)
[app-musicexpo.git] / lib / App / MusicExpo.pm
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{
This page took 0.010224 seconds and 4 git commands to generate.