- $end_position += $end - $start;
- MPD::exec("move", "$add_position:$end_position", "$start")
- if ($add_position != $start);
+ MPD::exec("status");
+ MPD::exec("command_list_end");
+
+ while (<$sock>) {
+ last if (/^OK/);
+ die($_) if (/^ACK/);
+
+ if (/^(\w+): (.*)$/) {
+ if ($1 eq "playlistlength") {
+ $newlen = int($2);
+ }
+ }
+ }
+
+ $count = $newlen - $pl_current_length;
+
+ MPD::exec("command_list_begin");
+ if ($newlen > $pl_current_length) {
+ MPD::exec("move", "$add_position:$newlen", $dst)
+ if ($add_position != $dst);
+ }