Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting currently playing on a group/room #61

Open
marcaddeo opened this issue Apr 5, 2016 · 6 comments
Open

Getting currently playing on a group/room #61

marcaddeo opened this issue Apr 5, 2016 · 6 comments

Comments

@marcaddeo
Copy link

When I have multiple Sonos grouped together, there's no way for me to tell which one to poll to get the currently playing. You have to poll the master.

Is it possible to tell which device is the master of the room/group? That way I can then get the currently playing track from that device.

Or am I missing something super obvious?

@DPH
Copy link
Member

DPH commented Apr 5, 2016

Look at groups.py in SoCo. This allows you to find the marster of any group - documentation in the code.

from soco import SoCo
device = SoCo('192.168.1.69')
print(device.player_name)
print(device.group.coordinator.player_name)

Have fun, Cheers Daivd

@marcaddeo
Copy link
Author

Hi @DPH,

I guess the question was can you do this with the current socos utility? If not, I'd happily give a shot at adding it and submitting a PR!

@DPH
Copy link
Member

DPH commented Apr 11, 2016

Hi @marcaddeo,
it works with the current SoCo utility, not tried it on Socos the command line version.
In that it imports SoCo it can't be far away....

Sorry I don't know for sure
Regards David

@KennethNielsen
Copy link
Member

@marcaddeo socos currently uses SoCo version 0.8 and from what I can see in the release notes: http://docs.python-soco.com/en/latest/releases/0.8.html the group functionality was luckily introduced in just that version, so I think all the pieces should be in place for it. So if you want to give it a shot, go crazy ;)

@petteraas
Copy link
Member

The 'requires_coordinator' https://github.com/SoCo/socos/blob/master/socos/utils.py#L42 already takes care of this for some specific functions.

@KennethNielsen
Copy link
Member

@petteraas ah yeah. I had forgotten about that one. Re-reading the code (that I think I wrote some of) I see that the add_command decorator uses that function and that the methods that gets the current track info is marked as requiring coordinator. This should mean that the command is automatically called on the coordinator/master. I did a quick test, and indeed it does seem to do just that. So @marcaddeo I guess the answer is that 'yes' socos master should already implement that. Please give it a try and see if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants