]> git.ktnx.net Git - mpd-feeder.git/commitdiff
proper mpd connection initialization
authorDamyan Ivanov <dmn@debian.org>
Thu, 11 Nov 2021 09:25:27 +0000 (09:25 +0000)
committerDamyan Ivanov <dmn@debian.org>
Thu, 11 Nov 2021 09:25:27 +0000 (09:25 +0000)
bin/mpd-feeder

index 7c796c71f4f1e5e65eba5a66dd774eb5f3fb6add..f0ed182eb3a56dda8c191aaff5a345266ad78a6f 100755 (executable)
@@ -150,11 +150,11 @@ use Net::Async::MPD;
         $opt->parse_command_line;
 
         unless ($opt->dump_config) {
-            $mpd = Net::Async::MPD->new(
-                host         => $opt->mpd_host,
-                port         => $opt->mpd_port,
-                auto_connect => 1,
-            );
+            my %conn = ( auto_connect => 1 );
+            $conn{host} = $opt->mpd_host if $opt->mpd_host;
+            $conn{port} = $opt->mpd_port if $opt->mpd_port;
+
+            $mpd = Net::Async::MPD->new(%conn);
 
             $self->connect_db;
             $self->update_db unless $self->opt->skip_db_update;