Intents- to triggers actions. One of the most frequently used keywords is
play. This means that several Skills can all use the word
Intents- causing something called an intent collision - where Mycroft doesn't know which Skill to invoke because there are so many to choose from.
Intentwhich uses the
playkeyword. The confidence score is designed so that there is a much higher probability of the right Skill being invoked to handle an
Intentwhich has the keyword
CommonPlaySkillclass instead of
CommonPlaySkillclass instead of the normal
MycroftSkill. Your Skill also needs to implement two methods,
phraseis sent from the
PlaybackControlSkill, and is the entire phrase said by the user with the
playkeyword stripped out. So if the user says
phraseargument will contain
CPSMatchLevel.EXACT(The input matches exact)
CPSMatchLevel.MULTI_KEY(The input contains multiple matches such as Artist and Album title)
CPSMatchLevel.TITLE(The phrase contains a matching title)
CPSMatchLevel.ARTIST(The phrase contains a matching artist)
CPSMatchLevel.CATEGORY(The phrase contains a category supported by the skill, Rock, bitpop, Podcast etc.)
CPSMatchLevel.GENERIC(Generic match, maybe contains the skill title but no media match)
CPSMatchLevel.EXACTis the greatest confidence and the
CPS_start()method as an argument.
CPS_startsimply starts the playback using the data and/or the phrase to determine what to play.
self.audioserviceobject can be used to start playback or queue up tracks.
mycroft.util.parsecan be used to fuzzy match one of the elements in the dict.
CPS_match_query_phrasemethod to use it to select the best match. This fuzzy matching system will match strings that are close to one of the keys in the above
dict. This means phrases like "play crazy comet" will be matched with a fairly high confidence despite not being the exact string in the dictionary.