}
}
-$feeder->connect_db;
-
-for ( ;; ) {
- $feeder->queue_songs( undef, sub { $feeder->run } );
-
- $log->debug("Entering event loop. PID=$$");
-
- my $result = $feeder->mpd->loop->run;
- $log->trace( "Got loop result of " . ( $result // 'undef' ) );
-
- if ('reload' eq $result) {
- $log->notice("disconnecting");
- $feeder->stop;
-
- exec( "$0", '--config', $feeder->cfg_file, '--skip-db-update' );
- }
-}
+$feeder->run_loop;
undef $db;
}
}
+
+ method run_loop {
+ $self->connect_db;
+
+ for ( ;; ) {
+ $self->queue_songs( undef, sub { $self->run } );
+
+ $log->debug("Entering event loop. PID=$$");
+
+ my $result = $mpd->loop->run;
+ $log->trace( "Got loop result of " . ( $result // 'undef' ) );
+
+ if ( 'reload' eq $result ) {
+ $log->notice("disconnecting");
+ $self->stop;
+
+ exec( "$0", '--config', $self->cfg_file, '--skip-db-update' );
+ }
+ }
+ }
}