Closed david-morris closed 3 years ago
I'm having some trouble with building an intent. Does anyone have experience using regexes in the intent? @pcwii, is there a reason why I don't see any of the regexes in this project being used in intent handler decorators? Is there a reason why they're all one line?
@david-morris, I don't usually use regex in my intents. And I don't use Padatious. All of my intents are built using keywords (vocab/en-us/*.voc). I am using the regex files to parse the remainder of the intents and determine what is being requested. Yes this could be done with regex in the intents but not something I got used to doing early on in mycroft.ai development and have been continuing to follow my old habits. Currently all the regex files are loaded with the self.translate_regex() function. This function is currently hardcoded with en-us and will need to be updated at some point to support multiple languages.
To assist, I have been using this api for reference. https://kodi.wiki/view/JSON-RPC_API/Examples https://kodi.wiki/view/JSON-RPC_API/v10 All the existing JSON-RPC items can be found in .kodi_tools. I am sure this can be made more efficient but this was my attempt to disconnect this application from other dependencies that either became stale or did not have the functionality I required.
Yeah, I asked in the mattermost channel for skill development and nobody saw what I was doing wrong, so I'll use the translate_regex function.
Closed by merge.
I'm opening this issue to say that I'm working on an "open favorite" function, and to write down the info I've learned that is needed.
Favorites can be fetched with
kodi.Favourites.GetFavourites(properties=['window','windowparameter','path'])['result']['favourites']
(that's a line of kodi-json which I use in the REPL, but I don't intend to pull it as a dependency).Then you just need to know whether its type is
window
,media
, orscript
.If it's a script, it's unsupported. Kore can't run scripts from the favourites menu either. I think the skill should say so?
If it's a window, it can be run with
kodi.GUI.ActivateWindow(window=favorite_item['window'],parameters=[favorite_item['windowparameter']])
but we should send a noop input event after it because some windows don't take the screen out of idle when opened.If it's media, it can be run with
kodi.Player.Open(item={"file":favourite_item['path']})
, whether it is actually a local file or a stream of some kind.