PDA

View Full Version : Command Line Interface question: determining presence of aplayer



Jeff Shanholtz
2004-04-08, 00:43
As best as I can tell, there is no way to determine the physical presence
of a player with the command line interface. Any commands or queries
succeed or return valid information. For example, if I query the mode it
may return "pause". If I then set the mode to "play" and query the mode, it
returns "play", even though the player (in this case, the softsqueeze)
isn't present.

Am I wrong? If there's a way to determine the presence of a player, I'd
like to know what it is! The Technical Information documentation doesn't
indicate how to do this as far as I can tell.

Thanks.

Chris Niekel
2004-04-08, 02:49
On Thu, Apr 08, 2004 at 12:43:57AM -0700, Jeff Shanholtz wrote:
> As best as I can tell, there is no way to determine the physical presence
> of a player with the command line interface. Any commands or queries

You can ask for the number of players available ("player count ?"),
and then for every player get the information about it
("player name 0 ?", same for ip, id, model.)

> Am I wrong? If there's a way to determine the presence of a player, I'd

I assume if a player isn't present, then it won't be in the list. But
then, my squeezebox is always there.

Greetings,
Chris Niekel
--
I've been down so long, if I'd cheer up, I'd still be depressed.
- Lisa Simpson, Moanin' Lisa Blues.

Jeff Shanholtz
2004-04-08, 09:16
On Thu, 8 Apr 2004 11:49:22 +0200, Chris Niekel wrote:

> On Thu, Apr 08, 2004 at 12:43:57AM -0700, Jeff Shanholtz wrote:
>> As best as I can tell, there is no way to determine the physical presence
>> of a player with the command line interface. Any commands or queries
>
> You can ask for the number of players available ("player count ?"),
> and then for every player get the information about it
> ("player name 0 ?", same for ip, id, model.)

Nope. These commands work whether the player is present or not.

>> Am I wrong? If there's a way to determine the presence of a player, I'd
>
> I assume if a player isn't present, then it won't be in the list. But
> then, my squeezebox is always there.

It is in the list, hence my problem. :)

Chris Niekel
2004-04-08, 09:30
On Thu, Apr 08, 2004 at 09:16:07AM -0700, Jeff Shanholtz wrote:
> Nope. These commands work whether the player is present or not.

Ah.. Is it listed as turned off then perhaps?

Chris
--
I've been down so long, if I'd cheer up, I'd still be depressed.
- Lisa Simpson, Moanin' Lisa Blues.

Jeff Shanholtz
2004-04-08, 10:14
On Thu, 8 Apr 2004 18:30:19 +0200, Chris Niekel wrote:

> On Thu, Apr 08, 2004 at 09:16:07AM -0700, Jeff Shanholtz wrote:
>> Nope. These commands work whether the player is present or not.
>
> Ah.. Is it listed as turned off then perhaps?

Nope. An absent player can be turned on and off and the power state can be
queried - it all "works" just as it would if the player were present. Not
even toggling the power state and then querying to see if it was successful
will work because the query will indicate that the power was indeed
toggled! :(

kdf
2004-04-08, 10:33
Quoting Jeff Shanholtz <jeffsubs (AT) shanholtz (DOT) com>:

> On Thu, 8 Apr 2004 18:30:19 +0200, Chris Niekel wrote:
>
> > On Thu, Apr 08, 2004 at 09:16:07AM -0700, Jeff Shanholtz wrote:
> >> Nope. These commands work whether the player is present or not.
> >
> > Ah.. Is it listed as turned off then perhaps?
>
> Nope. An absent player can be turned on and off and the power state can be
> queried - it all "works" just as it would if the player were present. Not
> even toggling the power state and then querying to see if it was successful
> will work because the query will indicate that the power was indeed
> toggled! :(

if player goes missing, the server isn't aware that its gone. Only on restart
will it only list teh remaining players. CLI won't give you any information on
this, becuase the server doesn't know either. If it did, there would be no need
for the "forget this player" link.

-kdf

Niek Jongerius
2004-04-08, 10:39
Dunno with what you try to determine if the player is there, but
if you are able to query the IP address, wouldn't a ping or a poke
at the TCP port on that IP address give you your info ?

Niek.

Jeff Shanholtz
2004-04-08, 10:50
On Thu, 08 Apr 2004 10:33:48 -0700, kdf wrote:

> if player goes missing, the server isn't aware that its gone. Only on restart
> will it only list teh remaining players. CLI won't give you any information on
> this, becuase the server doesn't know either. If it did, there would be no need
> for the "forget this player" link.

But surely there is bidirectional communication between the server and
clients, right? It should be able to "ping" the clients to determine if
they're present, or at the very least, I would think that if you try to
alter the state of the client (such as the power state), the server would
recognize that the attempt failed. It doesn't even appear when you query
the client's state that the server even asks client; it appears to simply
report what the server _thinks_ is the state of the client.

If you're curious, I'll explain why this is an issue for me. As indicated
in a prior thread, I'm writing a little program to handle the multimedia
keys on my multimedia keyboard so that they perform the functions on my
slimp3. However, I thought it would be cool if this program could
automatically detect the presence of the SoftSqueeze (by checking for the
presence of a client on localhost) and route the commands to it /only if it
is present/. Otherwise the commands would go to the slimp3.

Jeff Shanholtz
2004-04-08, 11:41
On Thu, 8 Apr 2004 19:39:55 +0200 (CEST), Niek Jongerius wrote:

> Dunno with what you try to determine if the player is there, but
> if you are able to query the IP address, wouldn't a ping or a poke
> at the TCP port on that IP address give you your info ?

Perhaps. What TCP port on the client would I use? And would that work both
for the squeeze and the slim (since they use different protocols)?

Niek Jongerius
2004-04-08, 12:06
>> Dunno with what you try to determine if the player is there, but
>> if you are able to query the IP address, wouldn't a ping or a poke
>> at the TCP port on that IP address give you your info ?
>
> Perhaps. What TCP port on the client would I use? And would that work both
> for the squeeze and the slim (since they use different protocols)?

Damn. Must be sleeping already. You want to check whether a Squeeze or
a Slim is active. They don't listen on TCP ports (well, at least mine
doesn't). But you should be able to just ping the IP address you received
from the query to the server. This would establish that there is some
device on the network using that address. Whether that's still the player
could still be a question, unless you're sure this address won't be
hijacked by some other device.

But I agree with some other post, in that the server should be able to
simply detect that a player is not on the wire. At least the SqueezeBox
does it's time screen saver via a TCP session. If this session isn't there,
it probably means the player is gone. That doesn't mean the player should
be removed from the player's list in the server, but a simple state that
you could query would be nice (something like "last seen" in seconds).

Niek.

seanadams
2004-04-08, 12:11
Sounds like we need a command to just list the clients that are
connected.

Just knowing that a squeezebox is at a particular IP isn't that helpful
because it doesn't tell you for sure that it's connected to the right
server (could even be connected to remote server).

BTW you can tell from the MAC address if it's a squeezebox. Our MAC
prefix is 000420, and squeezebox MACs are 00042005xxxx. Also you can
tell if its connected by ethernet or wireless. Our wireless addresses
are odd and ethernet are even.

On Apr 8, 2004, at 12:06 PM, Niek Jongerius wrote:

>>> Dunno with what you try to determine if the player is there, but
>>> if you are able to query the IP address, wouldn't a ping or a poke
>>> at the TCP port on that IP address give you your info ?
>>
>> Perhaps. What TCP port on the client would I use? And would that work
>> both
>> for the squeeze and the slim (since they use different protocols)?
>
> Damn. Must be sleeping already. You want to check whether a Squeeze or
> a Slim is active. They don't listen on TCP ports (well, at least mine
> doesn't). But you should be able to just ping the IP address you
> received
> from the query to the server. This would establish that there is some
> device on the network using that address. Whether that's still the
> player
> could still be a question, unless you're sure this address won't be
> hijacked by some other device.
>
> But I agree with some other post, in that the server should be able to
> simply detect that a player is not on the wire. At least the SqueezeBox
> does it's time screen saver via a TCP session. If this session isn't
> there,
> it probably means the player is gone. That doesn't mean the player
> should
> be removed from the player's list in the server, but a simple state
> that
> you could query would be nice (something like "last seen" in seconds).
>
> Niek.
>

Jeff Shanholtz
2004-04-08, 13:01
On Thu, 8 Apr 2004 21:06:15 +0200 (CEST), Niek Jongerius wrote:

>>> Dunno with what you try to determine if the player is there, but
>>> if you are able to query the IP address, wouldn't a ping or a poke
>>> at the TCP port on that IP address give you your info ?
>>
>> Perhaps. What TCP port on the client would I use? And would that work both
>> for the squeeze and the slim (since they use different protocols)?
>
> Damn. Must be sleeping already. You want to check whether a Squeeze or
> a Slim is active. They don't listen on TCP ports (well, at least mine
> doesn't). But you should be able to just ping the IP address you received
> from the query to the server. This would establish that there is some
> device on the network using that address. Whether that's still the player
> could still be a question, unless you're sure this address won't be
> hijacked by some other device.

That won't work well for SoftSqueeze clients, because the host computer
will (likely) respond to the ping but that tells you nothing about the
presence of the client.

Jeff Shanholtz
2004-04-08, 13:07
On Thu, 8 Apr 2004 12:11:46 -0700, Sean Adams wrote:

> Sounds like we need a command to just list the clients that are
> connected.

So is this something I should enter into the bug database? Any idea when
this might be implemented? Thanks!

dean
2004-04-08, 14:28
Yes, please enter it in the bug database!

Thanks,

dean

On Apr 8, 2004, at 1:07 PM, Jeff Shanholtz wrote:

> On Thu, 8 Apr 2004 12:11:46 -0700, Sean Adams wrote:
>
>> Sounds like we need a command to just list the clients that are
>> connected.
>
> So is this something I should enter into the bug database? Any idea
> when
> this might be implemented? Thanks!
>
>