Skip to content

Commit

Permalink
better_cps (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: jarbasal <[email protected]>
  • Loading branch information
JarbasAl and JarbasAl authored Mar 10, 2021
1 parent d6f1435 commit a2f258e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 22 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <img src='./res/icon/trvekvlt_icon.png' card_color='#40DBB0' width='50' height='50' style='vertical-align:bottom'/>Trve Kvlt Black Metal Skill
# <img src='./res/icon/trvekvlt_icon.png' card_color='#40DBB0' width='50' height='50' style='vertical-align:bottom'/>Black Metal Music Catalog Skill

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

Expand All @@ -8,6 +8,7 @@
Extensive library of Black Metal music for mycroft

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

## Installation Notes

Expand Down
35 changes: 15 additions & 20 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
from ovos_utils.skills.templates.video_collection import VideoCollectionSkill, \
CPSMatchLevel, CPSMatchType
from mycroft.skills.core import intent_file_handler
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 pyvod import Collection, Media
from os.path import join, dirname, basename
from ovos_utils.playback import CPSMatchType, CPSPlayback, CPSMatchConfidence


class BlackMetalSkill(VideoCollectionSkill):

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

path = join(dirname(__file__), "res", "trveKvlt.jsondb")
self.default_image = join(dirname(__file__), "res", "trvekvlt_logo.png")
# load video catalog
self.media_collection = Collection("TrveKvlt", logo=self.default_image, db_path=path)
self.media_collection = Collection("TrveKvlt",
logo=self.skill_logo, db_path=path)

def get_intro_message(self):
self.speak_dialog("intro")
Expand All @@ -28,33 +34,22 @@ def handle_homescreen_utterance(self, message):

# matching
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.01
match = CPSMatchLevel.GENERIC
score += 1

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

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

if self.voc_match(phrase, "black-metal"):
score += 0.3
match = CPSMatchLevel.TITLE
score += 50

return match, score

def calc_final_score(self, phrase, base_score, match_level):
score = base_score
if self.voc_match(phrase, "black-metal"):
score += 0.6
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.
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.4.0
json_database>=0.2.1
ovos_utils>=0.0.5
ovos_utils>=0.0.8a1
22 changes: 22 additions & 0 deletions res/desktop/skill.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Black Metal Music Catalog",
"skillname": "skill-trve-kvlt",
"authorname": "JarbasSkills",
"foldername": "",
"url": "https://github.com/JarbasSkills/skill-trve-kvlt",
"branch": "v0.1",
"desktopFile": false,
"warning": "",
"systemDeps": false,
"platforms": [
"arm",
"arm64",
"i386",
"x86_64",
"ia64"
],
"examples": [
"open black metal menu",
"play black metal"
]
}
Empty file added ui/bg.jpg
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/bg.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/trvekvlt_icon.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 a2f258e

Please sign in to comment.