Index: Networking/SqueezeNetwork/Players.pm =================================================================== --- Networking/SqueezeNetwork/Players.pm (revision 25883) +++ Networking/SqueezeNetwork/Players.pm (working copy) @@ -22,7 +22,8 @@ my $prefs = preferences('server'); # List of players we see on SN -my $PLAYERS = []; +my $CONNECTED_PLAYERS = []; +my $INACTIVE_PLAYERS = []; # Default polling time my $POLL_INTERVAL = 300; @@ -60,7 +61,8 @@ sub shutdown { my $class = shift; - $PLAYERS = []; + $CONNECTED_PLAYERS = []; + $INACTIVE_PLAYERS = []; Slim::Utils::Timers::killTimers( undef, \&fetch_players ); @@ -90,7 +92,7 @@ } if ( $log->is_debug ) { - $log->debug( "Got list of SN players: " . Data::Dump::dump( $res->{players} ) ); + $log->debug( "Got list of SN players: " . Data::Dump::dump( $res->{players}, $res->{inactive_players} ) ); $log->debug( "Next player check in " . $res->{next_poll} . " seconds" ); } @@ -103,7 +105,8 @@ } # Update player list - $PLAYERS = $res->{players}; + $CONNECTED_PLAYERS = $res->{players}; + $INACTIVE_PLAYERS = $res->{inactive_players}; # Update list of active music services if ( $res->{active_services} ) { @@ -136,7 +139,8 @@ $prefs->remove('sn_session'); # We don't want a stale list of players, so clear it out on error - $PLAYERS = []; + $CONNECTED_PLAYERS = []; + $INACTIVE_PLAYERS = []; # Backoff if we keep getting errors my $count = $prefs->get('snPlayersErrors') || 0; @@ -155,7 +159,15 @@ sub get_players { my $class = shift; - return wantarray ? @{$PLAYERS} : $PLAYERS; + return wantarray ? @{$CONNECTED_PLAYERS} : $CONNECTED_PLAYERS; +} + +sub is_known_player { + my ($class, $client) = shift; + + my $mac = ref($client) ? $client->macaddress() : $client; + + return scalar( grep { $mac eq $_->{mac} } @{$CONNECTED_PLAYERS}, @{$INACTIVE_PLAYERS} ); } sub disconnect_player { Index: Web/Pages/Home.pm =================================================================== --- Web/Pages/Home.pm (revision 25883) +++ Web/Pages/Home.pm (working copy) @@ -208,7 +208,7 @@ || $params->{'switchto'} eq Slim::Utils::Strings::string('SQUEEZENETWORK')) { # Bug 7254, don't tell Ray to reconnect to SN - if ( $client->deviceid != 7 ) { + if ( $client->deviceid != 7 || Slim::Networking::SqueezeNetwork::Players->is_known_player($client) ) { Slim::Utils::Timers::setTimer( $client, time() + 1,