forslund / mpd_skill

A Mycroft skill for controlling MPD media servers
GNU General Public License v3.0
11 stars 9 forks source link

Can't connect to MPD server after running a while #8

Open chowbok opened 6 years ago

chowbok commented 6 years ago

After mycroft has been running for a day or so, I stop being able to use the MPD skill. It looks like it's having problems connecting to the MPD server. Log is attached. output.txt

boik99 commented 6 years ago

Hi! Just started trying to use the MPD skill, but I too am having "already connected" issues, every time I try to play anything. It worked the very first time I tried it, but I get the error below every time now. I haven't changed anything apart from rebooting a few times. Any help gratefully received.

17:43:14.511 - SKILLS - DEBUG - {"type": "intent_failure", "data": {"lang": "en-us", "utterance": "play the cure"}, "context": {}} 17:43:14.522 - mycroft.skills.padatious_service:handle_fallback:101 - DEBUG - Padatious fallback attempt: play the cure 17:43:14.559 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.start", "data": {"handler": "fallback"}, "context": null} 17:43:14.616 - SKILLS - DEBUG - {"type": "-1690272375:Play.intent", "data": {"music": "the cure", "utterance": "play the cure"}, "context": null} 17:43:14.627 - mpd_skillinit:handle_play_playlist:125 - INFO - Handling play request 17:43:14.690 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.complete", "data": {"handler": "fallback", "fallback_handler": "PadatiousService.ha ndle_fallback"}, "context": null} 17:43:14.782 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.start", "data": {"name": "handle_play_playlist"}, "context": null} 17:43:16.039 - mpd - DEBUG - Calling MPD clear() 17:43:16.043 - mpd - DEBUG - Calling MPD stop() 17:43:16.108 - SKILLS - DEBUG - {"type": "speak", "data": {"expect_response": false, "utterance": "Playing The Cure"}, "context": {}} 17:43:16.187 - SKILLS - DEBUG - {"type": "recognizer_loop:audio_output_start", "data": {}, "context": null} 17:43:17.706 - SKILLS - DEBUG - {"type": "recognizer_loop:audio_output_end", "data": {}, "context": null} 17:43:19.060 - mpd - DEBUG - Calling MPD clear() 17:43:19.063 - mpd - DEBUG - Calling MPD searchadd('artist', 'The Cure') 17:43:19.067 - mpd - INFO - Calling MPD connect('192.168.1.246', 6600, timeout=None) 17:43:19.094 - mycroft.skills.core:wrapper:629 - ERROR - An error occurred while processing a request in MPDSkill Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/mycroft_core-0.9.17-py2.7.egg/mycroft/skills/core.py", line 595, in wrapper self.skill_id)) File "/opt/mycroft/skills/mpd_skill/init.py", line 143, in handle_play_playlist self.server.searchadd('artist', p) File "/opt/mycroft/skills/mpd_skill/init.py", line 23, in searchadd super(MPDReconnectable, self).connect(self.uri, self.port) File "/usr/local/lib/python2.7/site-packages/mpd.py", line 526, in connect raise ConnectionError("Already connected") ConnectionError: Already connected 17:43:19.113 - SKILLS - DEBUG - {"type": "speak", "data": {"expect_response": false, "utterance": "An error occurred while processing a request in MPDSkill"}, "context": {}} 17:43:19.137 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.complete", "data": {"exception": "Already connected", "name": "handle_play_playlist "}, "context": null}

boik99 commented 6 years ago

OK, I think I found out what it was. "searchadd" no longer seems to be a valid MPD command, so I've changed it to "findadd" and it's now working perfectly.

forslund commented 6 years ago

@boik99 Thanks for identifying this. Can you send a Pull request with the change?

boik99 commented 6 years ago

Hi Ake.

I'm not a coder, or familiar with github. I just hack stuff about to suit my needs. Here is a diff, which also adds the ability to add individual tracks. Not sure if it is any use. Ill try and read up on github and pull requests.

21c21 < return super(MPDReconnectable, self).findadd(*args)

        return super(MPDReconnectable, self).searchadd(*args)

24c24 < return super(MPDReconnectable, self).findadd(*args)

        return super(MPDReconnectable, self).searchadd(*args)

107d106 < self.tracks = self.server.list('title') 110c109 < self.playlist = self.albums + self.artists + self.tracks + self.genres

    self.playlist = self.albums + self.artists + self.genres

145,146d143 < elif p in self.tracks: < self.server.searchadd('title', p)

forslund commented 6 years ago

Thanks! If you like I'll include it and give you credit for the change

boik99 commented 6 years ago

Your welcome. Hope it works for everyone. I've only tested it with about 7,000 tracks. Not sure if something like 100,000 would cause problems.