X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=lib%2FApp%2FMPD%2FFeeder%2FDB.pm;h=e38279a127c4dd53c3892bf8711b4ccb1edb993c;hb=4404a46e92de24d8f6db57109c62be71ffbd47be;hp=ce0bcdd643f3c18ac02f974ef073bc92ccb4cd0f;hpb=7c6d525e11f4c624f21de3a2473b734c2bdd7a31;p=mpd-feeder.git diff --git a/lib/App/MPD/Feeder/DB.pm b/lib/App/MPD/Feeder/DB.pm index ce0bcdd..e38279a 100644 --- a/lib/App/MPD/Feeder/DB.pm +++ b/lib/App/MPD/Feeder/DB.pm @@ -261,6 +261,23 @@ SQL $log->debug("DB generation is $generation"); } + method walk_unwanted_artists($callback) { + $self->connect; + + my $count = 0; + + my $sth = $db->prepare('SELECT artist FROM unwanted_artists ORDER BY 1'); + my $artist; + $sth->execute; + $sth->bind_columns(\$artist); + while ( $sth->fetchrow_arrayref ) { + $count++; + $callback->($artist); + } + + return $count; + } + method disconnect { return unless $db;