$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;