Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
uploaded skill
  • Loading branch information
kfezer authored Apr 26, 2017
1 parent ee69488 commit 3ecac9b
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# skill-singing
Mycroft Sings
# Singing Skill

## Usage:
* `sing`

70 changes: 70 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Mycroft Core is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.


from os.path import dirname, join
import time
import random
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
from mycroft.util import play_mp3
from mycroft.util.log import getLogger

__author__ = 'kfezer'

LOGGER = getLogger(__name__)


class SingingSkill(MycroftSkill):
def __init__(self):
super(SingingSkill, self).__init__(name="SingingSkill")
self.process = None
self.play_list = {
0: join(dirname(__file__), "popey-favourite.mp3"),
1: join(dirname(__file__), "popey-jackson.mp3"),
2: join(dirname(__file__), "popey-jerusalem.mp3"),
3: join(dirname(__file__), "popey-lose-yourself.mp3"),
4: join(dirname(__file__), "popey-lovemetender.mp3"),
5: join(dirname(__file__), "popey-rocketman.mp3"),
}

def initialize(self):
intent = IntentBuilder("SingingIntent").require(
"SingingKeyword").build()
self.register_intent(intent, self.handle_intent)

def handle_intent(self, message):
rando = random.randint(0,5)
file = self.play_list[rando]
try:
self.speak_dialog('singing')
time.sleep(3)
self.process = play_mp3(file)


except Exception as e:
LOGGER.error("Error: {0}".format(e))

def stop(self):
if self.process and self.process.poll() is None:
self.speak_dialog('singing.stop')
self.process.terminate()
self.process.wait()


def create_skill():
return SingingSkill()
Binary file added __init__.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions dialog/en-us/singing.dialog
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
I would be happy to sing for you.
Here I go.
I'm a bit nervous about my voice, but here goes nothing.

3 changes: 3 additions & 0 deletions dialog/en-us/singing.stop.dialog
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thank you for listening
I hope you liked my voice
now you try
Binary file added popey-favourite.mp3
Binary file not shown.
Binary file added popey-jackson.mp3
Binary file not shown.
Binary file added popey-jerusalem.mp3
Binary file not shown.
Binary file added popey-lose-yourself.mp3
Binary file not shown.
Binary file added popey-lovemetender.mp3
Binary file not shown.
Binary file added popey-rocketman.mp3
Binary file not shown.
2 changes: 2 additions & 0 deletions vocab/en-us/SingingKeyword.voc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sing
sing me a song

0 comments on commit 3ecac9b

Please sign in to comment.