Index: Slim/Control/Commands.pm =================================================================== --- Slim/Control/Commands.pm (revision 6012) +++ Slim/Control/Commands.pm (working copy) @@ -612,23 +612,6 @@ $newvalue = (1,2,0)[Slim::Player::Playlist::repeat($client)]; } - # Check the buffers for the client and reset based on repeat change - foreach my $everyclient ($client, Slim::Player::Sync::syncedWith($client)) { - - if ($everyclient->playmode() =~ /playout/) { - - if ($newvalue) { - - # changing to repeat all or one, set to continue playback - $everyclient->playmode('playout-play'); - } else { - - # repeat off, set to stop at end of track - $everyclient->playmode('playout-stop'); - } - } - } - Slim::Player::Playlist::repeat($client, $newvalue); $request->setStatusDone(); Index: Slim/Player/Source.pm =================================================================== --- Slim/Player/Source.pm (revision 6012) +++ Slim/Player/Source.pm (working copy) @@ -265,6 +265,27 @@ return $time; } +sub repeatCallback { + my $request = shift; + + my $client = $request->client(); + + # shor circuit if this client isn't the one in playout + return unless ($client->playmode =~ /playout/i); + + # Check the buffers for the client and reset based on repeat change + # call playmode function so that sync groups are handled + if (!Slim::Player::Playlist::repeat($client) && + (streamingSongIndex($client) == (Slim::Player::Playlist::count($client) - 1))) { + + playmode($client,'playout-stop'); + } + else { + + playmode($client,'playout-play'); + } +} + sub _returnPlayMode { my $client = shift; @@ -353,6 +374,13 @@ next if $everyclient->prefGet('silent'); + # set up a callback to handle repeat changes during buffer drain + if ($newmode =~ /^playout/) { + Slim::Control::Request::subscribe(\&repeatCallback,[['playlist'],['repeat']]); + } else { + Slim::Control::Request::unsubscribe(\&repeatCallback); + } + # when you resume, you go back to play mode if (($newmode eq "resume") ||($newmode eq "resumenow")) {