]> git.ktnx.net Git - mpd-feeder.git/blobdiff - bin/mpd-feeder
key artists by AlbumArtists
[mpd-feeder.git] / bin / mpd-feeder
index da60df88a227312970e952c9f4506ecebf33ac2b..d553ea3e1d885980f1d851a11da7a45d4688112f 100755 (executable)
@@ -180,6 +180,22 @@ use Net::Async::MPD;
                 },
             )
         );
+
+        $mpd->loop->add(
+            IO::Async::Signal->new(
+                name       => 'USR1',
+                on_receipt => sub {
+                    $log->debug("SIGUSR1 received. Dumping configuration to STDERR");
+                    my $old = select \*STDERR;
+                    try {
+                        $opt->dump;
+                    }
+                    finally {
+                        select $old;
+                    }
+                },
+            )
+        );
     }
 
     method connect_db {
@@ -283,7 +299,7 @@ SQL
             foreach my $entry (@$rows) {
                 next unless exists $entry->{file};
                 $self->db_store_song( $entry->{file},
-                    $entry->{Artist}, $entry->{Album} );
+                    $entry->{AlbumArtist}, $entry->{Album} );
                 $song_count++;
             }
 
@@ -383,7 +399,8 @@ SQL
                 sub {
                     my $present = scalar @{ $_[0] };
 
-                    $log->notice("Playlist contains $present songs");
+                    $log->notice( "Playlist contains $present songs. Wanted: "
+                            . $opt->target_queue_length );
                     if ( $present < $opt->target_queue_length ) {
                         $self->queue_songs(
                             $opt->target_queue_length - $present, $callback );