App-MPDSync

 view release on metacpan or  search on metacpan

lib/App/MPDSync.pm  view on Meta::CPAN

}

sub show_help {
  print <<'HELP';
Usage: mpd-sync [options] --from source [--to dest]

Options:
  -f,--from     Source MPD instance (required)
  -t,--to       Destination MPD instance (default localhost)
  -v,--verbose  Be noisy
  --no-daemon   Do not fork to background
  -V,--version  Show version and exit
  -h,--help     Show this help and exit
HELP

  exit;
}

sub show_version {
  say "mpd-sync (App::MPDSync) version $VERSION";
  exit;

lib/App/MPDSync.pm  view on Meta::CPAN

  };

  unless ($self->{from}) {
    say STDERR 'Source MPD not provided';
    show_help;
  }

  my $source = Net::MPD->connect($self->{from});

  if ($self->{daemon}) {
    $self->vprint('Forking to background');
    Proc::Daemon::Init;
  }

  {
    $self->vprint('Syncrhonizing initial playlist');

    my $dest = Net::MPD->connect($self->{to});
    $dest->stop;
    $dest->clear;
    $dest->add($_->{uri}) for $source->playlist_info;



( run in 0.955 second using v1.01-cache-2.11-cpan-0d23b851a93 )