From b51409ecde21fc408fdb7e4e69318d8d911c0d95 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Fri, 4 Aug 2017 06:59:19 +0200 Subject: make chunksize a config option --- clerk.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clerk.pl') diff --git a/clerk.pl b/clerk.pl index f371a57..bbd661c 100755 --- a/clerk.pl +++ b/clerk.pl @@ -29,6 +29,7 @@ my $general_cfg = $cfg->param(-block=>"General"); my $mpd_host = $general_cfg->{mpd_host}; my $db_file = $general_cfg->{database}; my $backend = $general_cfg->{backend}; +my $chunksize = $general_cfg->{chunksize}; my $columns_cfg = $cfg->param(-block=>"Columns"); my $albumartist_l = $columns_cfg->{albumartist_l}; @@ -65,11 +66,11 @@ sub create_db { 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); + my $times = int($songcount / $chunksize + 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; + my $chunk_size = $chunksize; for (my $i=0;$i<=$songcount;$i+=$chunk_size) { my $endnumber = $i+$chunk_size; my @temp_db = $mpd->search('filename', '', 'window', "$i:$endnumber"); -- cgit v1.2.3-24-g4f1b