From 6dd177a335e7ffe06102daaf1b09c9ca70ba888b Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Thu, 3 Aug 2017 21:55:13 +0200 Subject: automatically update caches --- clerk.pl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clerk.pl') diff --git a/clerk.pl b/clerk.pl index 8cff8af..3242bc7 100755 --- a/clerk.pl +++ b/clerk.pl @@ -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; -- cgit v1.2.3-24-g4f1b