samtherussell / squeezebox-controller

A python interface for controlling Logitech Squeezeboxes via the SqueezeboxServer
MIT License
14 stars 10 forks source link

Sync multiple players #2

Closed foxsam21 closed 5 years ago

foxsam21 commented 5 years ago

It does not look like there is a way to sync more than 2 players to each other. Is this something that is possible to be done?

samtherussell commented 5 years ago

Sorry for the delay. You are right! Currently you can only sync pairs of players at a time. You can in fact then sync another one, and another...and so on. On my system I have actually built a custom command to all players to this one with the following funtion:

def sync_all(helper, details):
      if "player" not in details:
        raise Exception("Player not specified")
      if details["player"] not in helper['player_lookup']:
        raise Exception("Player must be one of: %s"%(", ".join(helper['player_lookup'])))

      master = helper['player_lookup'][details['player']]
      helper['make_request'](master, commands["POWER ON"])
      for slave in helper['player_lookup'].values():
        if not slave == master:
          helper['make_request'](master, ["sync",slave])
          helper['make_request'](slave, commands["POWER ON"])