Skip to content

Commit

Permalink
better_cps (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: jarbasal <jarbasai@mailfence.com>
  • Loading branch information
JarbasAl and JarbasAl committed Mar 10, 2021
1 parent 70e5e1b commit a93b7bd
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 37 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <img src='./res/icon/smod_icon.png' card_color='#40DBB0' width='50' height='50' style='vertical-align:bottom'/>SMOD Skill
# <img src='./res/icon/smod_icon.png' card_color='#40DBB0' width='50' height='50' style='vertical-align:bottom'/>Stoned Meadow of Doom Skill

![](./res/smod_logo.png)

Expand All @@ -8,6 +8,8 @@
Stoner Doom for mycroft

![](./gui.png)
![](./gui.gif)
![](./gui2.gif)

## Installation Notes

Expand Down
57 changes: 23 additions & 34 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
from ovos_utils.waiting_for_mycroft.common_play import CPSMatchType, \
CPSMatchLevel
from ovos_utils.skills.templates.media_collection import MediaCollectionSkill
from pyvod import Collection
from os.path import join, dirname, basename
from ovos_utils.skills.templates.video_collection import VideoCollectionSkill
from mycroft.skills.core import intent_file_handler
from mycroft.util.parse import fuzzy_match, match_one
from pyvod import Collection, Media
from os.path import join, dirname, basename
import random
from json_database import JsonStorageXDG
from ovos_utils.playback import CPSMatchType, CPSPlayback, CPSMatchConfidence


class SMODSkill(MediaCollectionSkill):
class SMODSkill(VideoCollectionSkill):

def __init__(self):
super().__init__("SMOD")
self.message_namespace = basename(dirname(__file__)) + ".jarbasskills"
self.default_image = join(dirname(__file__), "ui", "smod_logo.png")
self.skill_logo = join(dirname(__file__), "ui", "smod_icon.png")
self.skill_icon = join(dirname(__file__), "ui", "smod_icon.png")
self.default_bg = join(dirname(__file__), "ui", "smod_logo.png")
self.supported_media = [CPSMatchType.GENERIC,
CPSMatchType.VIDEO,
CPSMatchType.MUSIC]

path = join(dirname(__file__), "res", "smod.jsondb")
logo = join(dirname(__file__), "res", "smod_logo.png")
# load video catalog
self.media_collection = Collection("smod", logo=logo, db_path=path)
self.media_collection = Collection("smod", logo=self.skill_logo,
db_path=path)
self.media_type = CPSMatchType.MUSIC
self.playback_type = CPSPlayback.AUDIO

def get_intro_message(self):
self.speak_dialog("intro")
Expand All @@ -31,39 +35,24 @@ def handle_homescreen_utterance(self, message):
self.handle_homescreen(message)

def match_media_type(self, phrase, media_type):
match = None
score = 0

if self.voc_match(phrase,
"video") or media_type == CPSMatchType.VIDEO:
score += 0.1
match = CPSMatchLevel.GENERIC

if self.voc_match(phrase,
"music") or media_type == CPSMatchType.MUSIC:
score += 0.1
match = CPSMatchLevel.CATEGORY
if self.voc_match(phrase, "music") or media_type == CPSMatchType.MUSIC:
score += 10

if self.voc_match(phrase, "doom"):
score += 0.1
match = CPSMatchLevel.CATEGORY
score += 25

if self.voc_match(phrase, "smod"):
score += 0.2
match = CPSMatchLevel.TITLE
if self.voc_match(phrase, "metal"):
score += 15

return match, score
if self.voc_match(phrase, "stoner"):
score += 30
if self.voc_match(phrase, "doom"):
score += 30

def calc_final_score(self, phrase, base_score, match_level):
score = base_score
if self.voc_match(phrase, "doom") and self.voc_match(phrase, "stoner"):
score += 0.5
elif self.voc_match(phrase, "doom"):
score += 0.15
elif self.voc_match(phrase, "stoner"):
score += 0.15
if self.voc_match(phrase, "smod"):
score = 1.0
score += 80

return score

Expand Down
Binary file added gui.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gui2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions locale/en-us/metal.voc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metal
1 change: 1 addition & 0 deletions locale/en-us/smod.voc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
stoned meadow of doom
stoned meadow doom
smod
3 changes: 2 additions & 1 deletion locale/en-us/stoner.voc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
stoner
stoner
stoned
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
py_VOD>=0.3.1
json_database>=0.2.1
ovos_utils>=0.0.4rc2
ovos_utils>=0.0.8a1
21 changes: 21 additions & 0 deletions res/desktop/skill.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Stoned Meadow of Doom Skill",
"skillname": "skill-smod",
"authorname": "JarbasSkills",
"foldername": "",
"url": "https://github.com/JarbasSkills/skill-smod",
"branch": "v0.1",
"desktopFile": false,
"warning": "",
"systemDeps": false,
"platforms": [
"arm",
"arm64",
"i386",
"x86_64",
"ia64"
],
"examples": [
"open stoned meadow of doom", "play stoner doom"
]
}
1 change: 1 addition & 0 deletions skill_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/JarbasSkills/skill-better-playback-control
Binary file added ui/smod_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/smod_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a93b7bd

Please sign in to comment.