]> git.ktnx.net Git - mpd-feeder.git/commitdiff
no warnings on undef usage when idle waiting results in no changes
authorDamyan Ivanov <dmn@debian.org>
Thu, 18 Nov 2021 06:14:09 +0000 (06:14 +0000)
committerDamyan Ivanov <dmn@debian.org>
Thu, 18 Nov 2021 06:14:09 +0000 (06:14 +0000)
this is normal when the idle mode is stopped with 'noidle'

lib/App/MPD/Feeder.pm

index ed5d27658da5a27a6a9d2a88b9ca5b4372f059c8..7da421a6433bbcc0a8f805cc8d103306200c7c0a 100644 (file)
@@ -237,14 +237,22 @@ use constant DEFAULT_CONFIG_FILE => '/etc/mpd-feeder/mpd-feeder.conf';
             sub {
                 my $result = shift;
 
-                if ( $result->{changed} eq 'database' ) {
+                undef $idler;
+
+                my $changed = $result->{changed} // '';
+
+                if ( $changed eq 'database' ) {
                     $db_needs_update = 1;
                     $self->prepare_to_wait_idle;
                 }
-                elsif ( $result->{changed} eq 'playlist' ) {
+                elsif ( $changed eq 'playlist' ) {
                     $self->queue_songs( undef,
                         sub { $self->prepare_to_wait_idle } );
                 }
+                elsif ( $changed eq '' ) {
+                    $log->debug("got no changes from idle");
+                    $self->prepare_to_wait_idle;
+                }
                 else {
                     use JSON;
                     $log->warn(