9 use Log::Any::Adapter Stderr => log_level => 'error';
11 my $feeder = App::MPD::Feeder->new();
14 my $cmd = shift @ARGV;
16 if ($cmd eq 'dump-config') {
17 die "dump-config command accepts no arguments\n" if @ARGV;
23 if ( $cmd eq 'add-unwanted-artist' ) {
24 die "Missing command arguments\n" unless @ARGV;
25 $feeder->set_db_needs_update(0);
26 for my $artist (@ARGV) {
27 if ( $feeder->db_add_unwanted_artist($artist) ) {
28 $log->info("Artist '$artist' added to the unwanted list\n");
31 $log->warn("Artist '$artist' already in the unwanted list\n");
37 if ( $cmd eq 'del-unwanted-artist' ) {
38 die "Missing command arguments\n" unless @ARGV;
39 $feeder->set_db_needs_update(0);
40 for my $artist (@ARGV) {
41 if ( $feeder->db_del_unwanted_artist($artist) ) {
42 $log->info("Artist '$artist' deleted from the unwanted list\n");
45 $log->warn("Artist '$artist' is not in the unwanted list\n");
51 if ( $cmd eq 'add-unwanted-album' ) {
52 die "NOT IMPLEMENTED\n";
55 if ( $cmd eq 'one-shot' ) {
56 die "one-shot command accepts no arguments\n" if @ARGV;
58 $feeder->queue_songs(undef, sub { exit });
59 $feeder->mpd->loop->run;
61 elsif ( $cmd eq 'single' ) {
62 die "single command accepts no arguments\n" if @ARGV;
64 $feeder->queue_songs(1, sub { exit });
65 $feeder->mpd->loop->run;
68 die "Unknown command '$cmd'";