+ die
+ "Syntax: mpd-feeder add-unwanted-album «album name» by «artist name»\n"
+ unless @args == 3 and $args[1] =~ /^by$/i;
+ $self->set_db_needs_update(0);
+ my ( $album, $artist ) = @args[ 0, 2 ];
+ if ( $self->db->add_unwanted_album( $album, $artist ) ) {
+ $log->info(
+ "Album «$album» by «$artist» added to the unwanted list\n"
+ );
+ }
+ else {
+ $log->warn(
+ "Album «$album» by «$artist» already in the unwanted list\n"
+ );
+ }
+
+ return 0;
+ }
+
+ if ( $cmd eq 'del-unwanted-album' ) {
+ die
+ "Syntax: mpd-feeder del-unwanted-album «album name» by «artist name»\n"
+ unless @args == 3 and $args[1] =~ /^by$/i;
+ $self->set_db_needs_update(0);
+ my ( $album, $artist ) = @args[ 0, 2 ];
+ if ( $self->db->del_unwanted_album( $album, $artist ) ) {
+ $log->info(
+ "Album «$album» by «$artist» deleted from the unwanted list\n"
+ );
+ }
+ else {
+ $log->warn(
+ "Album «$album» by «$artist» is not in the unwanted list\n"
+ );
+ }
+
+ return 0;
+ }
+
+ if ( $cmd eq 'list-unwanted-albums' ) {
+ die "This command has no arguments\n" if @args;
+ $self->set_db_needs_update(0);
+ my $count = $self->db->walk_unwanted_albums(
+ sub ( $album, $artist ) { say "«$album» by «$artist»" } );
+ say "Total unwanted albums: $count";
+
+ return 0;