diff --git a/README.md b/README.md index 19360a0..8a2114a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Skill to determine when Mycroft AI has finished booting up. ## About -With this skill Mycroft will say when the boot up period has finished and is ready to receive commands. +With this skill Mycroft will say "finished booting" or play a startup sound when the boot up period has finished and is ready to receive commands. ## Examples @@ -12,5 +12,11 @@ zelmon64 (@zelmon64), Wally Fort (@fortwally), JarbasAI (@JarbasAI) ## Category **Configuration** -## Tags +You may optionally add a configuration stanza to mycroft.conf to play an mp3 file instead of speaking: +``` + "FinishedBootingSkill": { + "startup_mp3": "/home/pi/chimes-1948.mp3" + } +``` +## Tags diff --git a/__init__.py b/__init__.py index cc93942..93945e0 100644 --- a/__init__.py +++ b/__init__.py @@ -17,19 +17,30 @@ from mycroft import MycroftSkill from mycroft.util.log import LOG +from mycroft.configuration import ConfigurationManager +from mycroft.util import play_mp3 class FinishedBootingSkill(MycroftSkill): # The constructor of the skill, which calls MycroftSkill's constructor def __init__(self): super(FinishedBootingSkill, self).__init__(name="FinishedBootingSkill") - + def initialize(self): self.add_event("mycroft.skills.initialized", self.handle_boot_finished) LOG.debug('add event handle boot finished') - + config = ConfigurationManager.get() + base_conf = config.get('FinishedBootingSkill') + if base_conf: + self.mp3_file = base_conf.get('startup_mp3', None) + else: + self.mp3_file = None + def handle_boot_finished(self): - self.speak_dialog('finished.booting') + if self.mp3_file: + play_mp3(self.mp3_file) + else: + self.speak_dialog('finished.booting') LOG.debug('finished booting') # The "create_skill()" method is used to create an instance of the skill.