Public Member Functions | Public Attributes | Private Member Functions | List of all members
mycroft.skills.common_play_skill.CommonPlaySkill Class Reference
Inheritance diagram for mycroft.skills.common_play_skill.CommonPlaySkill:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, name=None, bus=None)
 
def bind (self, bus)
 
def CPS_match_query_phrase (self, phrase)
 Abstract methods All of the following must be implemented by a skill that wants to act as a CommonPlay Skill. More...
 
def CPS_play (self, args, kwargs)
 
def CPS_start (self, phrase, data)
 
def stop (self)
 

Public Attributes

 audioservice
 
 play_service_string
 
 spoken_name
 

Private Member Functions

def __calc_confidence (self, match, phrase, level)
 
def __handle_play_query (self, message)
 
def __handle_play_start (self, message)
 

Detailed Description

To integrate with the common play infrastructure of Mycroft
skills should use this base class and override the two methods
`CPS_match_query_phrase` (for checking if the skill can play the
utterance) and `CPS_start` for launching the media.

The class makes the skill available to queries from the
mycroft-playback-control skill and no special vocab for starting playback
is needed.

Definition at line 32 of file common_play_skill.py.

Constructor & Destructor Documentation

def mycroft.skills.common_play_skill.CommonPlaySkill.__init__ (   self,
  name = None,
  bus = None 
)

Definition at line 42 of file common_play_skill.py.

Member Function Documentation

def mycroft.skills.common_play_skill.CommonPlaySkill.__calc_confidence (   self,
  match,
  phrase,
  level 
)
private

Definition at line 96 of file common_play_skill.py.

def mycroft.skills.common_play_skill.CommonPlaySkill.__handle_play_query (   self,
  message 
)
private

Definition at line 68 of file common_play_skill.py.

def mycroft.skills.common_play_skill.CommonPlaySkill.__handle_play_start (   self,
  message 
)
private

Definition at line 125 of file common_play_skill.py.

def mycroft.skills.common_play_skill.CommonPlaySkill.bind (   self,
  bus 
)
Overrides the normal bind method.
Adds handlers for play:query and play:start messages allowing
interaction with the playback control skill.

This is called automatically during setup, and
need not otherwise be used.

Definition at line 54 of file common_play_skill.py.

def mycroft.skills.common_play_skill.CommonPlaySkill.CPS_match_query_phrase (   self,
  phrase 
)

Abstract methods All of the following must be implemented by a skill that wants to act as a CommonPlay Skill.

Analyze phrase to see if it is a play-able phrase with this
skill.

Args:
    phrase (str): User phrase uttered after "Play", e.g. "some music"

Returns:
    (match, CPSMatchLevel[, callback_data]) or None: Tuple containing
 a string with the appropriate matching phrase, the PlayMatch
 type, and optionally data to return in the callback if the
 match is selected.

Definition at line 174 of file common_play_skill.py.

def mycroft.skills.common_play_skill.CommonPlaySkill.CPS_play (   self,
  args,
  kwargs 
)
Begin playback of a media file or stream

Normally this method will be invoked with somthing like:
   self.CPS_play(url)
Advanced use can also include keyword arguments, such as:
   self.CPS_play(url, repeat=True)

Args:
    same as the Audioservice.play method

Definition at line 144 of file common_play_skill.py.

def mycroft.skills.common_play_skill.CommonPlaySkill.CPS_start (   self,
  phrase,
  data 
)
Begin playing whatever is specified in 'phrase'

Args:
    phrase (str): User phrase uttered after "Play", e.g. "some music"
    data (dict): Callback data specified in match_query_phrase()

Definition at line 206 of file common_play_skill.py.

def mycroft.skills.common_play_skill.CommonPlaySkill.stop (   self)

Definition at line 162 of file common_play_skill.py.

Member Data Documentation

mycroft.skills.common_play_skill.CommonPlaySkill.audioservice

Definition at line 44 of file common_play_skill.py.

mycroft.skills.common_play_skill.CommonPlaySkill.play_service_string

Definition at line 45 of file common_play_skill.py.

mycroft.skills.common_play_skill.CommonPlaySkill.spoken_name

Definition at line 49 of file common_play_skill.py.


The documentation for this class was generated from the following file:


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:40