summaryrefslogtreecommitdiffstats
path: root/clerk.pl
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2017-08-04 06:59:19 +0200
committerRasmus Steinke <rasi@xssn.at>2017-08-04 06:59:19 +0200
commitb51409ecde21fc408fdb7e4e69318d8d911c0d95 (patch)
treee28880eef0ef42c76bb3fa5f6416673395a8518c /clerk.pl
parenta12c133d5aebeba9a34421dabf33737e8a6c50ee (diff)
downloadperl-app-clerk-b51409ecde21fc408fdb7e4e69318d8d911c0d95.tar.gz
perl-app-clerk-b51409ecde21fc408fdb7e4e69318d8d911c0d95.tar.xz
make chunksize a config option
Diffstat (limited to 'clerk.pl')
-rwxr-xr-xclerk.pl5
1 files changed, 3 insertions, 2 deletions
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");