philippe44/LMS-Groups

Adding member to group whilst group is active does not sync player until stop/start

CDrummond opened this issue · 11 comments

I'm updating Material's 'Manage players' dialog to allow dragging players onto a group player. This then adds them to the group. But, if the group is currently active the new player does not start playing - and does not appear to be part of the sync group. The player is added to the group - if I stop group playback, and restart, then it does play.

As of today that's by design. I'll refresh my memory and see if I can change that but there are many things that can only happen at group "gathering" and I'm not sure I'll be able to change that.

I had a look - this one is going to be difficult and/or requires a bit of code duplication, which I really don't like. You would also need a dedicated function to the group. How do you do that today? Using the "update" command and listing all members?

Yeah, I use the "update" command to add a player. If this is going to be a lot of hassle then its probably not worth it. I don't think its a regular use case, I only spotted as I was playing around with it in Material's dialog. I could just add a message stating player will appear in group when group playback stops.

Feel free to close this as 'wontfix' if you like.

I'll give it a try. First I'll change the "update" command to add an optional leading '+' or '-' in front of member id list so that you can easily add or delete one.

ok - so it's really too complicated and will require a fair bit of code changes & corner cases management that I'm not ready to do now, if you don't mind.

At least what I did was refreshing the CLI handling and add missing parameter (greedy = always reclaim all player when a group start) and I've extended the update syntax to allow a list with + and - in front of client id so that you do a delta, you don't have to send the whole list. I've also at least done a bit of sanity check to stop playback if needed when all members or a playing member is removed. I've pushed that as a dev version, not been able to do much test yet, so let me know

Thanks for this. Removing members seems to work, adding does not. Looks like the member list gets corrupted - config has:

  members:
  - - []
  - 01:02:03:04:05:bb

Had a similar issue removing a player from a group.

To be honest, the standard update is enough for me. Now that the status update has the list of members, updating is easy.

But the delta update allows me to better handle removal - at least stopping nicely the player. Can you give me access to a material preview so I can better test?

I've updated Material's code in github to use the delta updates. You should just be able to clone my repo.


I tried the following tests with the git/master versions of Groups and Material.

First test:

  1. Erase groups.prefs
  2. Create an empty group with ["playergroups","add","name:Test","members:","powerMaster:1","powerPlay:1"]
  3. Config now has:
_client:02:00:e8:54:00:6b:
  _ts_greedy: 1591042922
  _ts_members: 1591042922
  _ts_powerMaster: 1591042922
  _ts_powerPlay: 1591042922
  _ts_volumes: 1591042922
  _version: 0
  greedy: 0
  members: []
  powerMaster: 1
  powerPlay: 1
  volumes: {}
  1. Add a player to the group with ["playergroups","update","id:02:00:e8:54:00:6b","members:+01:02:03:04:05:06"]
  2. Config new has:
_client:02:00:e8:54:00:6b:
  _ts_greedy: 1591042922
  _ts_members: 1591042961
  _ts_powerMaster: 1591042922
  _ts_powerPlay: 1591042922
  _ts_volumes: 1591042922
  _version: 0
  greedy: 0
  members:
  - - []
  - 01:02:03:04:05:06
  powerMaster: 1
  powerPlay: 1
  volumes: {}
  1. Remove the player from the group with ["playergroups","update","id:02:00:e8:54:00:6b","members:-01:02:03:04:05:06"]
  2. Config now has:
_client:02:00:e8:54:00:6b:
  _ts_greedy: 1591042922
  _ts_members: 1591043002
  _ts_powerMaster: 1591042922
  _ts_powerPlay: 1591042922
  _ts_volumes: 1591042922
  _version: 0
  greedy: 0
  members:
  - - - - []
      - 01:02:03:04:05:06
  powerMaster: 1
  powerPlay: 1
  volumes: {}

Second test:

  1. Erase groups.prefs
  2. Create group containing 2 players with ["playergroups","add","name:Test","members:80:19:34:d5:0a:02,01:02:03:04:05:06","powerMaster:1","powerPlay:1"]
  3. Config now has:
_client:02:00:46:55:11:ac:
  _ts_greedy: 1591043070
  _ts_members: 1591043070
  _ts_powerMaster: 1591043070
  _ts_powerPlay: 1591043070
  _ts_volumes: 1591043070
  _version: 0
  greedy: 0
  members:
  - 80:19:34:d5:0a:02
  - 01:02:03:04:05:06
  powerMaster: 1
  powerPlay: 1
  volumes: {}
  1. Remove one of the players from the group with ["playergroups","update","id:02:00:46:55:11:ac","members:-80:19:34:d5:0a:02"]
  2. Config now has:
_client:02:00:46:55:11:ac:
  _ts_greedy: 1591043070
  _ts_members: 1591043117
  _ts_powerMaster: 1591043070
  _ts_powerPlay: 1591043070
  _ts_volumes: 1591043070
  _version: 0
  greedy: 0
  members:
  - - - 80:19:34:d5:0a:02
      - 01:02:03:04:05:06
  powerMaster: 1
  powerPlay: 1
  volumes: {}

Hope the above helps.

well ... after all this years I still trip on arrays and references to arrays ... this is sad

Seems to be working now, thanks!


Yeah, perl has some really weird conventions. I find it hard to follow, not even knowing the parameter list for a function. Would be so nice to convert LMS to (e.g.) python. (Although that has its sill indentation rules...)