]> git.ktnx.net Git - mpd-feeder.git/blobdiff - lib/App/MPD/Feeder/DB.pm
add list-unwanted-artists command
[mpd-feeder.git] / lib / App / MPD / Feeder / DB.pm
index ce0bcdd643f3c18ac02f974ef073bc92ccb4cd0f..e38279a127c4dd53c3892bf8711b4ccb1edb993c 100644 (file)
@@ -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;