Skip to content
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

LMSPlayer errors when attempting to connect to player that is not conneced to server #10

Open
TristanStanton opened this issue Sep 22, 2017 · 1 comment

Comments

@TristanStanton
Copy link

When attempting to use the LMSPlayer class directly with a MAC address that is not connected on the Logitech Media Server the following error occurs:

LMSTools/LMSTools/player.py", line 121, in parse_request
return self.request(command).get(key)
AttributeError: 'NoneType' object has no attribute 'get'

I have been able to resolve this by checking if the self.request(command) is None before attempting the attribute get(key):

    rcommand = self.request(command)
    if rcommand == None:
    	return None
    else:
     return rcommand.get(key)

However think this could be better resolved by checking if the player is present on the server during init

@elParaguayo
Copy link
Owner

I'm not sure if doing it in __init__ is correct as the player could disconnect after the object has been initialised.

I think there just needs to be some error handling either returning None (as you suggest) or by raising some exception (e.g. ClientNotConnected) and having the user's code decide how to handle it.

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

No branches or pull requests

2 participants