Mycroft Community Forum

Testing and Feedback for Linux Rhythmbox Skill

I had in mind to add “song by artist” to the skill. Its been a while since I tinkered around. I appreciate the feedback. It’ll stir me to get back to doing some coding. Guten Tag!

1 Like

I published a new version of the skill that includes “title by artist” support.

supper works for me. I have only the problem with my 35mb database. would it help to change the XMLParser to iterparse?

Thanks for the suggestion. This was a hobby project of mine. I’m not the most literate on the ins and outs of Python and XML, having just a basic programming background. A Google search is leading me in the direction of lxml, interparse, and using element.clear. But I am open to any recommendations.

I opened an issue over on the skill’s github site to track benchmarking alternative xml logic. I’ll use it to comment on any progress or potential avenues in supporting larger Rhythmbox databases. Please feel free to visit and leave comments as well on any suggestions you might have regarding the efficient processing of the Rhythmbox xml databases. Regards.

1 Like

the reading at the start of the Skill could accelerate the whole thing

https://mycroft-core.readthedocs.io/en/stable/source/mycroft.util.html#get-cache-directory

1 Like

I’m now caching the Rhythmbox xml database in skill class list variables. The first time accessing the skill, it will cause the cache to be built. Subsequent calls to the skill will use the cache. Hopefully that will help individuals with large Rhythmbox databases.

1 Like

The skill goes right for songs / artists.
Might I suggest to add a command like “play album **” maybe with possibility to specify artist (“play album XX by artst XX”)?

1 Like

Thanks for the suggestion “docjuhnk”. I’ve added album and album by logic. I want to be careful not to weigh down the speed of the skill. But I kinda anticipated this request and can see where it would be handy.

I really appreciate everyone that uses the skill. Its nice to be able to contribute something to the open source community and to the potential that Mycroft exhibits.

1 Like

Works like a charm!
I can’t really say, that it has slowed my installation. (I have a little over 5k tracks / 460 Albums / 270 interprets in my database.)

Thanks for your quick reply and updating the skill.

2 Likes

@unwisebard contributed code to support Genres and also some tweaks to shorten search times. Have a look.

1 Like

@dwfalk this is just what I was looking for, Thanks! I just got it installed and will give it a whirl. :slight_smile:

Works like a charm. Mycroft now pulls from my local music dir. Next, I’ll get a map to my NAS. Thanks again.

1 Like

I’m thinking the skill might be ready for the next step…getting it onto the marketplace. Any guidance on how to proceed would be appreciated. Not sure how its dependence on Rhythmbox and Linux in general would affect this on the marketplace. Also, setting up testing…since it is largely dependent on each individual’s custom play list. Thanks.

I recently downloaded this skill and giving it a little run. For me Mycroft isn’t responding when I’m trying to get him to shuffle a playlist. “Mycroft, shuffle Rock Pop and Whatnot playlist on Rhythmbox”, and he just goes silent, I’m not sure if that was intended, sometimes it’s just nice to get an affirmative response from him. Also when I’m requesting some of my playlists “Mycroft play international playlist” or “Mycroft play international” he says “I’m not sure how to play international/international playlist”. Could this have to do with the playlist being called what it is? He has no problem responding to “Mycroft play Rock Pop and Whatnot.” However when he does he plays the genre more often than he plays the playlist I made, even when I say “Mycroft play Rock Pop and Whatnot playlist”.
When I’m calling out for specific songs it works like a charm.

If you have the ability to run Mycroft in debug mode, it may clear this up. Messages there show what the skill heard and the score given across the various options. There is a pecking order to how it searches, and can deliver undesired results if genres, playlists, artists, albums, or songs share similar names.

A couple things I learned. “On Rhythmbox” frequently doesn’t translate well. So I steer clear of that for the most part. If you say “Shuffle pop playlist”, with the word “playlist” being the key there, it may have a better chance of honoring playlist requests.

If you can post some debug results along with the exact phrase requested over on git as an issue, I can take a closer look. Thanks for giving the skill a spin.

Strange, after shutting down and rebooting the next day all the playlist stuff is perfectly fine now. It appears to be recognizing the utterances exactly the same as before according to the cli page history. I’m not gonna complain about it!

1 Like

So… this is clearly not ready. For any kind of marketplace. Yet.

I have a… well not small collection of Final Fantasy OSTs

If I say play Final Fantasy 7 Original Soundtrack it will play anything from Tour Japon, to Final Fantasy X Vocal Collections.

     01:50:09.362 | INFO     | 1298609 | __main__:handle_record_begin:37 | Begin Recording...
 01:50:12.401 | INFO     | 1298609 | __main__:handle_record_end:45 | End Recording...
 01:50:19.884 | INFO     | 1298609 | __main__:handle_utterance:72 | Utterance: ['play final fantasy 7']
 01:50:20.098 | INFO     | 1298603 | Playback Control Skill | Resolving Player for: final fantasy 7
~~~~ INFO     | 1298603 | mycroft.util:wait_while_speaking:448 | mycroft.utils.wait_while_speaking() is depreciated, use mycroft.audio.wait_while_speaking() instead.
 01:50:22.305 | INFO     | 1298603 | rhythmbox-skill_dwfalk | CPS_match_query: final fantasy 7
 01:50:22.306 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Genre Utterance: final fantasy 7
 01:50:22.307 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Genre Probabilities: ('modern classical, ambient', 35)
 01:50:22.308 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Playlist Utterance: final fantasy 7
 01:50:22.311 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Playlist Probabilities: ('Recently Added', 28)
 01:50:22.312 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Artist Utterance: final fantasy 7
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 01:50:22.321 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Artist Probabilities: ('final fantasy', 93)
 01:50:22.322 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Album Utterance: final fantasy 7
 01:50:22.329 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Album Probabilities: ('final fantasy 6', 93)
 01:50:22.330 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Title Utterance: final fantasy 7
 01:50:22.468 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Title Probabilities: ('final fantasy', 93)
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
~~~~y NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff400368670>: Failed to establish a new connection: [Errno -2] Name or service not known'))
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 01:50:27.424 | INFO     | 1298603 | Playback Control Skill | Playing with: rhythmbox-skill.dwfalk
 01:50:27.668 | INFO     | 1298603 | rhythmbox-skill_dwfalk | CPS_start: final fantasy 7
 01:50:27.936 | INFO     | 1298603 | Playback Control Skill | Audio service status: {}

The outcome of this was Tour Japon for example.

If I’m not fast enough the recording times out and I get that but this is somewhat frustrating. I’ve tried setting up a playlist but got this result

01:57:37.693 | INFO     | 1298609 | __main__:handle_record_begin:37 | Begin Recording...
 01:57:40.741 | INFO     | 1298609 | __main__:handle_record_end:45 | End Recording...
 01:57:46.155 | INFO     | 1298609 | __main__:handle_utterance:72 | Utterance: ['play final fantasy 7 playlist']
 01:57:46.369 | INFO     | 1298603 | Playback Control Skill | Resolving Player for: final fantasy 7 playlist
~~~~ INFO     | 1298603 | mycroft.util:wait_while_speaking:448 | mycroft.utils.wait_while_speaking() is depreciated, use mycroft.audio.wait_while_speaking() instead.
 01:57:47.678 | INFO     | 1298603 | rhythmbox-skill_dwfalk | CPS_match_query: final fantasy 7 playlist
 01:57:47.683 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Genre Utterance: final fantasy 7 playlist
 01:57:47.684 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Genre Probabilities: ('modern classical, downtempo, ambient', 30)
 01:57:47.685 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Playlist Utterance: final fantasy 7
 01:57:47.686 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Playlist Probabilities: ('Recently Added', 28)
 01:57:47.686 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Artist Utterance: final fantasy 7 playlist
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 01:57:47.703 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Artist Probabilities: ('final fantasy 9 ost plus', 75)
 01:57:47.703 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Album Utterance: final fantasy 7 playlist
 01:57:47.714 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Album Probabilities: ('final fantasy tactics', 76)
 01:57:47.714 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Title Utterance: final fantasy 7 playlist
 01:57:47.886 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Title Probabilities: ('final fantasy 1 main theme', 72)
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 01:57:52.452 | INFO     | 1298603 | Playback Control Skill | Playing with: rhythmbox-skill.dwfalk
 01:57:52.658 | INFO     | 1298603 | rhythmbox-skill_dwfalk | CPS_start: final fantasy 7 playlist
 01:57:52.867 | INFO     | 1298603 | Playback Control Skill | Audio service status: {}
~~~~y NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff405d06d60>: Failed to establish a new connection: [Errno -2] Name or service not known'))
  ^--- NEWEST ---^ 

This resulted in Melodies of Life from the Final Fantasy 9 OST Plus

If I use the album keyword…

02:00:29.446 | INFO | 1298609 | main:handle_record_begin:37 | Begin Recording…
02:00:32.459 | INFO | 1298609 | main:handle_record_end:45 | End Recording…
02:00:36.699 | INFO | 1298609 | main:handle_utterance:72 | Utterance: [‘play album final fantasy 7 original soundtrack’]
02:00:36.920 | INFO | 1298603 | Playback Control Skill | Resolving Player for: album final fantasy 7 original soundtrack

 02:00:39.128 | INFO     | 1298603 | rhythmbox-skill_dwfalk | CPS_match_query: album final fantasy 7 original soundtrack
 02:00:39.128 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Genre Utterance: album final fantasy 7 original soundtrack
 02:00:39.132 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Genre Probabilities: ('soundtrack', 39)
 02:00:39.132 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Playlist Utterance: album final fantasy 7 original soundtrack
 02:00:39.136 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Playlist Probabilities: ('My Top Rated', 23)
 02:00:39.136 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Artist Utterance: album final fantasy 7 original soundtrack
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 02:00:39.154 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Artist Probabilities: ('final fantasy x vocals', 60)
 02:00:39.154 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Album Utterance:  final fantasy 7 original soundtrack
 02:00:39.169 | INFO     | 1298603 | rhythmbox-skill_dwfalk | Album Probabilities: ('final fantasy 7 original soundtrack', 100)
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
~~~~y NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff405eaf3a0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 02:00:44.164 | INFO     | 1298603 | Playback Control Skill | Playing with: rhythmbox-skill.dwfalk
 02:00:44.408 | INFO     | 1298603 | rhythmbox-skill_dwfalk | CPS_start: album final fantasy 7 original soundtrack
 02:00:44.618 | INFO     | 1298603 | Playback Control Skill | Audio service status: {}

This resulted in the Final Fantasy X OST to start and a shuffled list of various others.

Thanks for the feedback. I have some ideas. But also some challanges that will be difficult to correct.

Regarding…CPS_match_query: final fantasy 7

In this case, you said “play Final Fantasy 7 Original Soundtrack”, but Mycroft only heard and passed along to the skill “play final fantasy 7”. I’ve noticed this too, at times. I would need the Mycroft folks to comment on that.

Regarding…Playlist Probabilities: (‘Recently Added’, 28)

The second example is interesting. You set up a playlist. But the best playlist the skill found was named “Recently Added”. Question, did the playlist already exist when Mycroft was started? Or was it added after the fact? For speed, the Rhythmbox database is only read when the skill is initialized and once an hour after that.

Regarding the album keyword and Album Probabilities: (‘final fantasy 7 original soundtrack’, 100)

That’s on me and I have an idea to correct it. I’ll need some time to tweak and test. With similarly named choices, it’ll be difficult to improve, but a combination of keywords and tweaked ranking may lead to better results. I’ll see if my ideas pan out. Thanks again, for trying out the skill and giving feedback.

1 Like

Ah… we need a command to refresh! (As that gets the playlist working).

You may wanna take a look at: How to get Mycroft to wait for my whole request

It is an awesome skill (it’ll be amazing once ready). Not usually a fan of rhythmbox but hey who am I to argue since I don’t have to look at it with this!

1 Like

Based on Julie’s feedback here on the Mycroft Community Forum, several enhancements were made to the code. The ability to “refresh the Rhythmbox database” on request was added. This will come in handy to individuals actively tweaking their Rhythmbox library and playlists while Mycroft is already active. On top of that, major code revisions now rank probabilities as opposed to the old hard-coded pecking order (with the exception of “exact” matches). Finally, along the lines of ranking, the code around keywords (such as “playlist”, “album”, “by”, etc.) was tweaked. Use keywords to enhance the ranking of requests where names are the same across options (such as a “country” playlist and a “country” genre).

Regarding the skill timing out mid request, that isn’t a skill setting but can now be tweaked in the Mycroft configuration file. See #2536

1 Like