PDA

View Full Version : SP - iterateSqueezeCenters



Triode
2010-01-06, 14:56
I'm using the following in applet installer. It seems to find multiple
servers - in my case SBS and the local TinySC, and I suspect from Erland's
reports it can also find multiple SBSs. Is SP now supposed to maintain
"connected" to multiple SBSs? If so is there an easy way of telling if a
server is TinySC rather than a full server?

The issue is that I need to make sure I send my query to the real SBS rather
than TinySC - I can't see an easy way of finding the right server at
present.

for id, server in appletManager:callService("iterateSqueezeCenters") do
if server:isConnected() and not server:isSqueezeNetwork() then

Thanks,

Adrian

gharris999
2010-01-06, 18:55
The issue is that I need to make sure I send my query to the real SBS rather than TinySC - I can't see an easy way of finding the right server at present.I suppose the problem is that the Touch's player could be 'connected' to a SBS that is down or asleep. So while the Touch's TinySC would show up, the Touch's player might not. So you couldn't reliably look for an instance where a player's IP == a server's IP to identify that server as a TinySC.

Both FatSBS and TinySC return a UUID (among other stuff) to a serverstatus CLI request. Couldn't some element of the UUID be made to somehow identify the server as a TinySC? Thus you could distinguish between TinySC & Fat SBS. Seems like a pretty trivial change to the SBS code to support this.

gharris999
2010-01-06, 19:58
Heh. Easier said than done.



#!/usr/bin/perl

require UUID::Tiny;

$szUUID4 = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V4() );
my $szUUID5a = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V5(), $szUUID4, "TinySC");
$szUUID4 = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V4() );
my $szUUID5b = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V5(), $szUUID4, "TinySC");
$szUUID4 = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V4() );
my $szUUID5c = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V5(), $szUUID4, "TinySC");
$szUUID4 = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V4() );
my $szUUID5d = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V5(), $szUUID4, "FatSC");
$szUUID4 = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V4() );
my $szUUID5e = UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V5(), $szUUID4, "FatSC");

print "V5 UUID: " . $szUUID5a . "\n";
print "V5 UUID: " . $szUUID5b . "\n";
print "V5 UUID: " . $szUUID5c . "\n";
print "V5 UUID: " . $szUUID5d . "\n";
print "V5 UUID: " . $szUUID5e . "\n\n";

..yields:


V5 UUID: 3c69b671-4b2a-5550-8bb9-dd1fa3241daa
V5 UUID: 2fa1877f-9b3d-5f03-9f54-65833d9a608c
V5 UUID: 988a53f9-e166-51ee-a8db-f7d80ae1c3b1
V5 UUID: 0d9f15f4-cbf5-53a6-bae5-ff555fa16f6b
V5 UUID: 7d338cf0-1be1-5dde-8bc9-6a2b83ba0be6

I'm not seeing any repetition in the pattern there at all.

mherger
2010-01-08, 08:09
Posting again as the mailinglist -> forum gateway seems to be broken...

> for id, server in appletManager:callService("iterateSqueezeCenters") do
> if server:isConnected() and not server:isSqueezeNetwork() then

As Gordon mentions reading the UUID might be key. I'm no SP expert, but the server's UUID is stored in the Playback object (server:getId() or similar). This would match the 'server_uuid' stored in SBS' server.prefs. I doubt there's already a clean way to read that values though. But imho it's the way to go anyway.

gharris999
2010-01-09, 17:32
I suppose one way to distinguish between a FatSC and an TinySC is by requesting http://sbs-ip:sbs-port/music/current/cover.jpg.

A FatSC always returns an image, no matter if there are players connected or not. TinySC never will.

This seems like an absurd kludge, though. There's GOT to be an easier way.

If anyone has a better way, I'd love to know!