-
Notifications
You must be signed in to change notification settings - Fork 18
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
LMSServer.show_players_sync_status() #5
Comments
Why would it return the players? The method shows which players are synced to which other players. There are already methods to get players from the server and I don't see this being one of the primary ways of doing so. I'm happy to be convinced otherwise though! It's certainly trivial to make this return player instances (I think I'd do this via an option as I don't see a reason for it to be default). As for your second question, I don't think there is a static number for the group. This method returns an index (based on the groups returned by the server) and is basically just there so you can see which players are in a group together. A group number is really meaningless. |
Have a look at the development branch. |
I am probably just thinking out loud. |
In a GUI, the player would be uniquely identified by server:port + player MAC. A GUIPlayer instance should check if a matching LMSPlayer instance can be created (i.e. if the player is connected at that moment) or change the way it appears if it can't. It should hang on to that LMSPlayer instance until connection is lost, at which point it could release the instance (or not). Between sessions of the GUI, you may also want to save the identifiers for the players (e.g. to remember which ones to display or hide). At any rate, thank you for your effort on this! |
As far as I was aware, players are identified just by the MAC address. That's why you can test equivalence of player instances and it looks at the MAC address (you can test equivalence by comparing two LMSPlayers or one LMSPlayer with a MAC address). If that's wrong then I'll happily amend the code. I'm no expert when it comes to LMS so I'm very happy to be corrected as to how it works and fix my code accordingly! |
There was a little bug in the player equivalence test which I've fixed in development branch. This is what I mean by the players being the same:
Is that enough for your GUI to tell that the players are the same? |
An instance that is equivalent but not equal doesn't work. But now I understand that LMSTools can not really keep track of its own instances; that is (and probably should be) up to wherever they are used. |
Can you explain why it doesn't work? If it's something vital, I'll consider amending the code. |
One way to deal with this could be to create an object that maintains a pool of LMSPlayers. This object should listen for the Then, when you get a player object you take it from the pool. When you get a new player, you can check it against the pool one and, if it's equivalent, take the pool one. That way you should be getting the same player object. I'm just speculating here because I don't immediately see the issue but, you're right, this is something I'm currently expecting the application to handle. Happy to help if I can. |
why wouldn't this return a list of player instances rather then the names and MACs?
and could player.get_synced_players() (optionally) also return the number of the sync group, assuming that is a static number.
The text was updated successfully, but these errors were encountered: