X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FMusicExpo.pm;h=3bdef011a6d7086d7ee766068e190a0271eba187;hb=b90b9dda037a4e41ac4aa11c80f70cb421c5feb2;hp=32c780623351a5fe41b06d43554bd2a5d68a1fd9;hpb=de93afc5b3d69c2bbf569fe495e579670aa756a6;p=app-musicexpo.git
diff --git a/lib/App/MusicExpo.pm b/lib/App/MusicExpo.pm
index 32c7806..3bdef01 100644
--- a/lib/App/MusicExpo.pm
+++ b/lib/App/MusicExpo.pm
@@ -3,7 +3,7 @@ use v5.14;
use strict;
use warnings;
-our $VERSION = '0.004';
+our $VERSION = '0.005';
use Audio::FLAC::Header qw//;
use HTML::Template::Compiled qw//;
@@ -123,6 +123,8 @@ sub normalizer{
"$_[0]|".(stat $_[0])[9]
}
+sub make_fragment{ join '-', map { lc =~ y/a-z0-9/_/csr } @_ }
+
sub run {
if ($cache) {
tie my %cache, 'DB_File', $cache, O_RDWR|O_CREAT, 0644;
@@ -132,10 +134,10 @@ sub run {
my %files;
for my $file (@ARGV) {
my $info;
- $info = thaw flacinfo $file if $file =~ /\.flac$/i;
- $info = thaw mp3info $file if $file =~ /\.mp3$/i;
- $info = thaw vorbisinfo $file if $file =~ /\.og(?:g|a)$/i;
- $info = thaw mp4info $file if $file =~ /\.mp4|\.aac|\.m4a$/i;
+ $info = thaw scalar flacinfo $file if $file =~ /\.flac$/i;
+ $info = thaw scalar mp3info $file if $file =~ /\.mp3$/i;
+ $info = thaw scalar vorbisinfo $file if $file =~ /\.og(?:g|a)$/i;
+ $info = thaw scalar mp4info $file if $file =~ /\.mp4|\.aac|\.m4a$/i;
next unless defined $info;
my $basename = fileparse $file, '.flac', '.mp3', '.ogg', '.oga', '.mp4', '.aac', '.m4a';
$files{$basename} //= [];
@@ -159,6 +161,7 @@ sub run {
}
}
delete $entry{$_} for qw/format file/;
+ $entry{fragment} = make_fragment @entry{qw/artist title/};
push @files, \%entry
}
@@ -180,7 +183,7 @@ $default_template = <<'HTML';
Title Artist Album Genre Track Year Type