From 5614c544d4ae33cdc9257d78fd18b6a63b84e47e Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 1 Aug 2015 19:07:59 +0300 Subject: [PATCH] Work with raw bytes instead of UTF-8 --- lib/App/MusicExpo.pm | 49 +++++++++++++++++++------------------------- musicexpo | 2 +- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/lib/App/MusicExpo.pm b/lib/App/MusicExpo.pm index a55b53c..f23063b 100644 --- a/lib/App/MusicExpo.pm +++ b/lib/App/MusicExpo.pm @@ -32,13 +32,6 @@ GetOptions ( "cache:s" => \$cache, ); - -sub fix{ - my $copy = $_[0]; - utf8::decode($copy); - $copy -} - sub flacinfo{ my $file=$_[0]; my $flac=Audio::FLAC::Header->new($file); @@ -46,13 +39,13 @@ sub flacinfo{ freeze +{ format => 'FLAC', - title => fix ($flac->tags('TITLE') // '?'), - artist => fix ($flac->tags('ARTIST') // '?'), - year => fix ($flac->tags('DATE') // '?'), - album => fix ($flac->tags('ALBUM') // '?'), - tracknumber => fix ($flac->tags('TRACKNUMBER') // '?'), - tracktotal => fix ($flac->tags('TRACKTOTAL') // '?'), - genre => fix ($flac->tags('GENRE') // '?'), + title => $flac->tags('TITLE') // '?', + artist => $flac->tags('ARTIST') // '?', + year => $flac->tags('DATE') // '?', + album => $flac->tags('ALBUM') // '?', + tracknumber => $flac->tags('TRACKNUMBER') // '?', + tracktotal => $flac->tags('TRACKTOTAL') // '?', + genre => $flac->tags('GENRE') // '?', file => $file, } } @@ -64,13 +57,13 @@ sub mp3info{ freeze +{ format => 'MP3', - title => fix ($mp3->title || '?'), - artist => fix ($mp3->artist || '?'), - year => fix ($mp3->year || '?'), - album => fix ($mp3->album || '?'), - tracknumber => fix ($mp3->track1 || '?'), - tracktotal => fix ($mp3->track2 || '?'), - genre => fix ($mp3->genre) || '?', + title => $mp3->title || '?', + artist => $mp3->artist || '?', + year => $mp3->year || '?', + album => $mp3->album || '?', + tracknumber => $mp3->track1 || '?', + tracktotal => $mp3->track2 || '?', + genre => $mp3->genre || '?', file => $file, } } @@ -82,13 +75,13 @@ sub vorbisinfo{ freeze +{ format => 'Vorbis', - title => fix($ogg->comment('TITLE') || '?'), - artist => fix ($ogg->comment('artist') || '?'), - year => fix ($ogg->comment('DATE') || '?'), - album => fix ($ogg->comment('ALBUM') || '?'), - tracknumber => fix ($ogg->comment('TRACKNUMBER') || '?'), - tracktotal => fix ($ogg->comment('TRACKTOTAL') || '?'), - genre => fix ($ogg->comment('GENRE')) || '?', + title => $ogg->comment('TITLE') || '?', + artist => $ogg->comment('artist') || '?', + year => $ogg->comment('DATE') || '?', + album => $ogg->comment('ALBUM') || '?', + tracknumber => $ogg->comment('TRACKNUMBER') || '?', + tracktotal => $ogg->comment('TRACKTOTAL') || '?', + genre => $ogg->comment('GENRE') || '?', file => $file, } } diff --git a/musicexpo b/musicexpo index a687c4d..c5887de 100755 --- a/musicexpo +++ b/musicexpo @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w -CSDA +#!/usr/bin/perl -w use v5.14; use App::MusicExpo; -- 2.30.2