jasperproject / jasper-client

Client code for Jasper voice computing platform
MIT License
4.53k stars 1.01k forks source link

mpdcontrol fails at commands #527

Closed mohkoh19 closed 8 years ago

mohkoh19 commented 8 years ago

Hi all, after having some trouble with getting Jasper run on Jessie I finally got everything to work with the version from the dev-branch. Unfortunately I recognized that if I enter the Music mode I am not able to play any music. The MPD Client stays in the 'stopped mode' all the time. After some time of analyzing the code I could solve the problem: In the "mpdclient.py" module the following method causes the bug: def get_playback_state(self): with self.connection() as conn: status = conn.status() state = status['state'] return state if state == 'play': return PLAYBACK_STATE_PLAYING elif state == 'pause': return PLAYBACK_STATE_PAUSED elif state == 'stop': return PLAYBACK_STATE_STOPPED else: raise RuntimeError('Unknown playback state!')

The state is "return" is set to early and returns the state as string from the conn object. To fix this the return statement simply has to be moved to the end of the method. I hope I could help someone to fix this problem and excuse me for my bad english :stuck_out_tongue_closed_eyes:

dmbuchta commented 8 years ago

This is fixed in #525, but it hasn't been merged yet.

mohkoh19 commented 8 years ago

Totally forgot that this is a development-branch, should have checked the closed issues too. At least it works!