Skip to content

Commit

Permalink
Fixes issue #5
Browse files Browse the repository at this point in the history
  • Loading branch information
elParaguayo committed Apr 7, 2017
1 parent f604c76 commit 7e671fd
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion LMSTools/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ def get_players(self):
self.players.append(player)
return self.players

def get_player_from_ref(self, ref):
"""
:rtype: LMSPlayer
:returns: Instance of player with specified MAC address (or None if \
player not found)
Get a player instance based on the provided MAC address.
"""
try:
return LMSPlayer(ref, self)
except AttributeError:
return None

def get_player_count(self):
"""
:rtype: int
Expand Down Expand Up @@ -117,8 +130,11 @@ def get_sync_groups(self):
syncgroups = [x.get("sync_members","").split(",") for x in groups.get("syncgroups_loop",dict())]
return syncgroups

def show_players_sync_status(self):
def show_players_sync_status(self, get_players=False):
"""
:param get_players: bool
:param get_players: (optional) return instance of LMSPlayer (default \
False)
:rtype: dict
:returns: dictionary (see attributes below)
:attr group_count: (int) Number of sync groups
Expand All @@ -130,6 +146,7 @@ def show_players_sync_status(self):
:attr name: Name of player
:attr ref: Player reference
:attr sync_index: Index of sync group (-1 if not synced)
:attr player: LMSPlayer instance (only if 'get_players' set to True)
::
Expand Down Expand Up @@ -161,6 +178,8 @@ def show_players_sync_status(self):
item["sync_index"] = index[0]
else:
item["sync_index"] = -1
if get_players:
item["player"] = player
all_players.append(item)

sync_status = {}
Expand Down

0 comments on commit 7e671fd

Please sign in to comment.