Open chowbok opened 1 year ago
Would be awesome if @forslund will update this skill. It means a lot to me to have it in my RPi media player.
Let me look at it tomorrow. When I last used it it was working but I might have done something stupid when updating it
Just tested here and for me it is still working. The error you report would occur if there was no "playlists" fetched from the mpd server. Can you verify that you get something like the following in the logs when the player starts
10:05:38.339 | INFO | 103889 | MPDSkill | TRYING TO CONNECT
10:05:38.339 | INFO | 103889 | mpd.base | Calling MPD connect('localhost', '6600', timeout=None)
10:05:38.342 | INFO | 103889 | MPDSkill | Fetching stuff!!!
10:05:38.342 | INFO | 103889 | MPDSkill | Albums...
10:05:38.375 | INFO | 103889 | MPDSkill | Artists...
10:05:38.378 | INFO | 103889 | MPDSkill | Genres...
10:05:38.380 | INFO | 103889 | MPDSkill | Titles...
10:05:38.438 | INFO | 103889 | MPDSkill | Done!
Okay, I've had some progress. Although I changed the server in the settings, the setting change didn't take effect until I restarted Mycroft. So now it is talking to my MPD server.
The problem now is that it seems to be timing out before getting results. If I ask for something, it tells me it doesn;t know how to play it, but like 20 seconds later the log says it's found it:
2022-11-27 10:39:15.781 | INFO | 17838 | Playback Control Skill | Resolving Player for: ham gravy
2022-11-27 10:39:23.431 | INFO | 17838 | Playback Control Skill | No matches
2022-11-27 10:39:47.312 | INFO | 17838 | MPDSkill | MPD Found {'artist': 'Ham Gravy'}
So maybe there's a setting in the Playback Control Skill I could adjust?
I found this in the Playback Control Skill:
self.schedule_event(self._play_query_timeout, 5,
I changed that to "30" and now it works. I imagine that'll revert at some point, though.
Ok, that's a known issue. with large collections the time for it find the best matching result is a bit long. You can try the branch feature/rapidfuzz which should boost the speed a bit. (you'll probably need to run mycroft-pip install rapidfuzz to ensure the new fuzzing requirement is installed.)
Another thing I can try is to create separate handling for artist, album and genre so the list of matches are smaller (play the album Armikrog OST, would only search albums for example)
The changes gave me an error. Should I be opening new tickets for these issues, or is it okay to keep commenting here?
(BTW, I really appreciate your taking the time to look into this stuff. I realize this doesn't affect a lot of people, so it's very kind of you to take out the time to help me.)
Maybe just keep it here for the time being.
Okay, I wasn't sure how to get it to install the updated release, so I just edited init.py manually. Pretty sure I did it right, though. Getting this error:
Traceback (most recent call last):
File "/opt/mycroft/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 73, in wrapper
handler(message)
File "/opt/mycroft/mycroft-core/mycroft/skills/common_play_skill.py", line 97, in __handle_play_query
result = self.CPS_match_query_phrase(search_phrase)
File "/opt/mycroft/skills/mpd_skill.forslund/__init__.py", line 155, in CPS_match_query_phrase
best = process.extract(phrase, self.playlist, limit=1)
File "src/rapidfuzz/process_cpp_impl.pyx", line 981, in rapidfuzz.process_cpp_impl.extract
File "src/rapidfuzz/process_cpp_impl.pyx", line 883, in rapidfuzz.process_cpp_impl.extract_list
File "src/rapidfuzz/process_cpp_impl.pyx", line 803, in rapidfuzz.process_cpp_impl.extract_list_f64
File "src/rapidfuzz/process_cpp_impl.pyx", line 223, in rapidfuzz.process_cpp_impl.preprocess_list
File "src/rapidfuzz/utils_cpp.pyx", line 25, in rapidfuzz.utils_cpp.default_process
TypeError: sentence must be a String
Ok the code is a bit ugly but pushed a branch update.
rapidfuzz should work ok and it contains some basic parsing for if it's a request for an artist, album or genre.
Kinda dumb question: what's the best way to install this? Before, I did "mycroft-msm install https://github.com/forslund/mpd_skill", but that only gives me the master. I'm getting an odd error now, but I manually downloaded everything and I might have screwed something up.
Branches requires some extra work to use but git should suffice.
You should be able to do something like
git fetch origin
git checkout update
In the skill folder
Thank you @forslund for the "update" branch, but what about if we have a track with the same name of an album?
ex. Dangerous (Michael Jackson album and a track inside the album)
Can we distinguish the one from another for all the requests we made, somehow?
hopefully I can add a play the track dangerous
and perhaps default to tracks if no specifier is given. I just need to see how I can list tracks from mpd...
that will be awesome!!
something like that?
https://python-mpd2.readthedocs.io/en/latest/topics/commands.html#MPDClient.list
Indeed, that is what I'm using for album / artist /genre, however 'title' is giving me some issue but it may be my mpd server. I will keep digging.
@chowbok sorry for the delay. Did you get the update branch working at all?
Just installed this again after a few years. Whatever I try to get it to play, it logs "Sorry MPD has no playlists" and says it's unable to play. Is this still working with the latest release?