Skip to content

Instantly share code, notes, and snippets.

@KennethNielsen
Last active May 6, 2016 07:50
Show Gist options
  • Select an option

  • Save KennethNielsen/a89564d61b5064a34871731a13a4984d to your computer and use it in GitHub Desktop.

Select an option

Save KennethNielsen/a89564d61b5064a34871731a13a4984d to your computer and use it in GitHub Desktop.

Revisions

  1. Kenneth Nielsen renamed this gist May 6, 2016. 1 changed file with 0 additions and 0 deletions.
  2. Kenneth Nielsen created this gist May 6, 2016.
    20 changes: 20 additions & 0 deletions Listing all actions available from Sonos
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    from __future__ import print_function

    import inspect
    import soco

    zone = soco.discovery.any_soco()

    # Get the base service class
    service_class = soco.services.Service

    # Loop over all members in soco.services ...
    for _, member in inspect.getmembers(soco.services):
    # ... and skip everything that isn't and class and a subclass of Service
    if not (inspect.isclass(member) and issubclass(member, service_class)):
    continue

    # Instantiate the service and print out all its actions
    service_instance = member(zone)
    for action, in_args, out_args in service_instance.iter_actions():
    print(action, in_args, out_args)