]> git.ktnx.net Git - mpd-feeder.git/blobdiff - lib/App/MPD/Feeder/Command.pm
add list-unwanted-artists command
[mpd-feeder.git] / lib / App / MPD / Feeder / Command.pm
index 37b8ee18747887dc258dbd1a2e962de530bdac56..9a425be023bb419fc5952b7fb7fc7c22de0f3492 100644 (file)
@@ -3,6 +3,7 @@ package App::MPD::Feeder::Command;
 use strict;
 use warnings;
 use utf8;
+use feature 'say';
 
 use Log::Any qw($log);
 use Object::Pad;
@@ -24,7 +25,7 @@ isa App::MPD::Feeder {
             die "Missing command arguments\n" unless @args;
             $self->set_db_needs_update(0);
             for my $artist (@args) {
-                if ( $self->db_add_unwanted_artist($artist) ) {
+                if ( $self->db->add_unwanted_artist($artist) ) {
                     $log->info(
                         "Artist '$artist' added to the unwanted list\n");
                 }
@@ -41,7 +42,7 @@ isa App::MPD::Feeder {
             die "Missing command arguments\n" unless @args;
             $self->set_db_needs_update(0);
             for my $artist (@args) {
-                if ( $self->db_del_unwanted_artist($artist) ) {
+                if ( $self->db->del_unwanted_artist($artist) ) {
                     $log->info(
                         "Artist '$artist' deleted from the unwanted list\n");
                 }
@@ -54,6 +55,15 @@ isa App::MPD::Feeder {
             return 0;
         }
 
+        if ( $cmd eq 'list-unwanted-artists' ) {
+            die "This command has no arguments\n" if @args;
+            $self->set_db_needs_update(0);
+            my $count = $self->db->walk_unwanted_artists( sub { say @_ } );
+            say "Total unwanted artists: $count";
+
+            return 0;
+        }
+
         if ( $cmd eq 'add-unwanted-album' ) {
             die "NOT IMPLEMENTED\n";
         }