Index: Slim/Control/Commands.pm =================================================================== --- Slim/Control/Commands.pm (revision 14950) +++ Slim/Control/Commands.pm (working copy) @@ -879,18 +879,22 @@ my $client = $request->client(); my $newvalue = $request->getParam('_newvalue'); - if (!defined $newvalue) { - $newvalue = (1,2,0)[Slim::Player::Playlist::shuffle($client)]; + # only handle shuffle if the feature is enabled. + if ($client->blockShuffle) { + + if (!defined $newvalue) { + $newvalue = (1,2,0)[Slim::Player::Playlist::shuffle($client)]; + } + + Slim::Player::Playlist::shuffle($client, $newvalue); + Slim::Player::Playlist::reshuffle($client); + #$client->currentPlaylistChangeTime(Time::HiRes::time()); + $client->currentPlaylistUpdateTime(Time::HiRes::time()); + + # Does the above change the playlist? + Slim::Player::Playlist::refreshPlaylist($client) if $client->currentPlaylistModified(); } - - Slim::Player::Playlist::shuffle($client, $newvalue); - Slim::Player::Playlist::reshuffle($client); - #$client->currentPlaylistChangeTime(Time::HiRes::time()); - $client->currentPlaylistUpdateTime(Time::HiRes::time()); - - # Does the above change the playlist? - Slim::Player::Playlist::refreshPlaylist($client) if $client->currentPlaylistModified(); - + $request->setStatusDone(); } Index: Slim/Player/Client.pm =================================================================== --- Slim/Player/Client.pm (revision 14950) +++ Slim/Player/Client.pm (working copy) @@ -230,6 +229,7 @@ $client->[125] = undef; # jiffiesEpoch $client->[126] = []; # jiffiesOffsetList; array tracking the relative deviations relative to our clock $client->[127] = undef; # frameData; array of (stream-byte-offset, stream-time-offset) tuples + $client->[128] = 0; # block function of shuffle commands. (default = no) $clientHash{$id} = $client; @@ -1688,4 +1688,9 @@ @_ ? ($r->[127] = shift) : $r->[127]; } +sub blockShuffle { + my $r = shift; + @_ ? ($r->[128] = shift) : $r->[128]; +} + 1; Index: Slim/Plugin/RandomPlay/Plugin.pm =================================================================== --- Slim/Plugin/RandomPlay/Plugin.pm (revision 14950) +++ Slim/Plugin/RandomPlay/Plugin.pm (working copy) @@ -356,6 +356,10 @@ )); } + # temporarily turn off shuffle while we add new stuff + my $oldshuffle = Slim::Player::Playlist::shuffle($client); + Slim::Player::Playlist::shuffle($client, 0); + # Replace the current playlist with the first item / track or add it to end my $request = $client->execute([ 'playlist', $addOnly ? 'addtracks' : 'loadtracks', sprintf('%s.id=%d', $type, $obj->id) @@ -379,6 +383,7 @@ } } + Slim::Player::Playlist::shuffle($client, $oldshuffle); return $obj->name; } @@ -528,8 +533,6 @@ $client->execute(['power', '1']); } - Slim::Player::Playlist::shuffle($client, 0); - my $find = {}; # Initialize find to only include user's selected genres. If they've deselected @@ -648,6 +651,7 @@ } $mixInfo{$client->masterOrSelf->id} = undef; + $client->blockShuffle = 0; } else { @@ -662,6 +666,7 @@ #will see a continuous mode state. if ($continuousMode) { $mixInfo{$client->masterOrSelf->id}->{'type'} = $type; + $client->blockShuffle = 1; } # $startTime will only be defined if this is a new (or restarted) mix