Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Server.get_player() finds device if not the full name is given #4

Open
jinglemansweep opened this issue Mar 17, 2012 · 0 comments
Open

Comments

@jinglemansweep
Copy link
Owner

Assume we have two SqueezeBoxes named 'Kids Bedroom' &
'Parents Bedroom'.

What steps will reproduce the problem?

  1. Server.get_player("rent")
  2. Server.get_player("Bedroom")

What is the expected output? What do you see instead?

  1. Should return None, but returns the player 'Parents Bedroom'
  2. Should return None or False, but returns the first found
    player with 'Bedroom' in its name.

What version of the product are you using? On what operating system?

r51 (Aug 14, 2011)

Please provide any additional information below.

Add an option to get_player() to search strictly or loosely.
=>>
def get_player(self, ref=None, strictly=False):
ref = str(ref).lower()
if ref:
for player in self.players:
player_name = str(player.name).lower()
player_ref = str(player.ref).lower()
if ref == player_ref or
(not strictly and ref in player_name) or
(strictly and ref == player_name):
return player

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant