my $default_template;
our $prefix='/music/';
-our $cache='cache.db';
-our $caching=1;
+our $cache='';
our $template='';
GetOptions (
"template=s" => \$template,
"prefix=s" => \$prefix,
"cache=s" => \$cache,
- "caching!" => \$caching,
);
}
sub run {
- tie my %cache, 'DB_File', $cache, O_RDWR|O_CREAT, 0644 if $caching;
- memoize 'flacinfo', NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] if $caching;
- memoize 'mp3info' , NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] if $caching;
+ 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 '';
my @files;
for my $file (@ARGV) {
=item B<--cache> I<filename>
-Path to the cache file. Created if it does not exist. Defaults to 'cache.db'
-
-=item B<--caching>, B<--no-caching>
-
-Enables or disables caching. Defaults to B<--caching>
+Path to the cache file. Created if it does not exist. If '' (empty), disables caching. Is empty by default.
=back
=head1 SYNOPSIS
- # Creates a table with the songs a.mp3 and b.flac using the default template and caching the tags in the file 'cache.db'. The download links point to /music/a.mp3 and /music/b.mp3
+ # Creates a table with the songs a.mp3 and b.flac using the default template and without caching. The download links point to /music/a.mp3 and /music/b.mp3
musicexpo a.mp3 b.flac
- # Disables caching, and the download links point to /download/a.flac, /download/b.flac, /download/c.flac
- musicexpo --no-caching --prefix /download/ my/music/a.flac my/music/b.flac othermusic/c.flac
+ # Caches to 'cache.db', and the download links point to /download/a.flac, /download/b.flac, /download/c.flac
+ musicexpo --cache 'cache.db' --prefix /download/ my/music/a.flac my/music/b.flac othermusic/c.flac
# Caches into /tmp/musicexpocache and uses directory/file.tmpl as template
musicexpo --cache /tmp/musicexpocache --template directory/file.tmpl my-music/*.mp3
=item B<--cache> I<filename>
-Path to the cache file. Created if it does not exist. Defaults to 'cache.db'
-
-=item B<--caching>, B<--no-caching>
-
-Enables or disables caching. Defaults to B<--caching>
+Path to the cache file. Created if it does not exist. If '' (empty), disables caching. Is empty by default.
=back