diff options
author | Rasmus Steinke <rasi@xssn.at> | 2017-08-03 21:55:13 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2017-08-03 21:55:13 +0200 |
commit | 6dd177a335e7ffe06102daaf1b09c9ca70ba888b (patch) | |
tree | 4de8562ada2a72661ae3cec17cc2d3c6193f4ae8 | |
parent | 6f0b6d0975fe42afff73f6efbc9002a0463103b0 (diff) | |
download | perl-app-clerk-6dd177a335e7ffe06102daaf1b09c9ca70ba888b.tar.gz perl-app-clerk-6dd177a335e7ffe06102daaf1b09c9ca70ba888b.tar.xz |
automatically update caches
-rwxr-xr-x | clerk.pl | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -41,6 +41,7 @@ my $artist_l = $columns_cfg->{artist_l}; my $mpd = Net::MPD->connect($ENV{MPD_HOST} // $mpd_host // 'localhost'); sub main { + create_db(); my %options=(); getopts("ta", \%options); list_tracks() if defined $options{t}; @@ -57,7 +58,9 @@ sub create_db { my $last_update = $mpd_stats->{db_update}; if (!-f "$db_file" || stat("$db_file")->mtime < $last_update) { + print STDERR "::: No cache found or cache file outdated\n"; my $times = int($songcount / 1000 + 1); + print STDERR "::: Requesting $times chunks from MPD\n"; my @db; # since mpd will silently fail, if response is larger than command buffer, let's split the search. my $chunk_size = 1000; |