use HTML::Template::Compiled qw//;
use Memoize qw/memoize/;
use MP3::Tag qw//;
+use Ogg::Vorbis::Header::PurePerl;
use DB_File qw//;
use File::Basename qw/fileparse/;
}
}
+sub vorbisinfo{
+ my $file=$_[0];
+ my $ogg=Ogg::Vorbis::Header::PurePerl->new($file);
+
+ 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')) || '?',
+ path => $file,
+ }
+}
+
sub normalizer{
"$_[0]|".(stat $_[0])[9]
}
tie my %cache, 'DB_File', $cache, O_RDWR|O_CREAT, 0644 unless $cache eq '';
memoize 'flacinfo', NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] unless $cache eq '';
memoize 'mp3info' , NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] unless $cache eq '';
+ memoize 'vorbisinfo' , NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] unless $cache eq '';
my @files;
for my $file (@ARGV) {
push @files, thaw flacinfo $file if $file =~ /.flac$/i;
push @files, thaw mp3info $file if $file =~ /.mp3$/i;
+ push @files, thaw vorbisinfo $file if $file =~ /.og(?:g|a)$/i;
}
my $ht=HTML::Template::Compiled->new(