summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2017-08-03 21:55:13 +0200
committerRasmus Steinke <rasi@xssn.at>2017-08-03 21:55:13 +0200
commit6dd177a335e7ffe06102daaf1b09c9ca70ba888b (patch)
tree4de8562ada2a72661ae3cec17cc2d3c6193f4ae8
parent6f0b6d0975fe42afff73f6efbc9002a0463103b0 (diff)
downloadperl-app-clerk-6dd177a335e7ffe06102daaf1b09c9ca70ba888b.tar.gz
perl-app-clerk-6dd177a335e7ffe06102daaf1b09c9ca70ba888b.tar.xz
automatically update caches
-rwxr-xr-xclerk.pl3
1 files changed, 3 insertions, 0 deletions
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;