1 package App::MPD::Feeder::Command;
10 class App::MPD::Feeder::Command
11 isa App::MPD::Feeder {
13 my $cmd = shift @args;
15 if ( $cmd eq 'dump-config' ) {
16 die "dump-config command accepts no arguments\n" if @args;
23 if ( $cmd eq 'add-unwanted-artist' ) {
24 die "Missing command arguments\n" unless @args;
25 $self->set_db_needs_update(0);
26 for my $artist (@args) {
27 if ( $self->db_add_unwanted_artist($artist) ) {
29 "Artist '$artist' added to the unwanted list\n");
33 "Artist '$artist' already in the unwanted list\n");
40 if ( $cmd eq 'del-unwanted-artist' ) {
41 die "Missing command arguments\n" unless @args;
42 $self->set_db_needs_update(0);
43 for my $artist (@args) {
44 if ( $self->db_del_unwanted_artist($artist) ) {
46 "Artist '$artist' deleted from the unwanted list\n");
50 "Artist '$artist' is not in the unwanted list\n");
57 if ( $cmd eq 'add-unwanted-album' ) {
58 die "NOT IMPLEMENTED\n";
61 if ( $cmd eq 'one-shot' ) {
62 die "one-shot command accepts no arguments\n" if @args;
64 $self->queue_songs( undef, sub {$self->mpd->loop->stop} );
65 $self->mpd->loop->run;
68 elsif ( $cmd eq 'single' ) {
69 die "single command accepts no arguments\n" if @args;
71 $self->queue_songs( 1, sub {$self->mpd->loop->stop} );
72 $self->mpd->loop->run;
76 die "Unknown command '$cmd'";