Skip to content

Commit

Permalink
bettercps (#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 6bd5eaa commit a92b6ed
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 31 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Audio Horror, readings of lovecraftian stories from HorrorBabble

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

## Installation Notes

Expand Down
46 changes: 18 additions & 28 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
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
import datetime
from ovos_utils.playback import CPSMatchType, CPSPlayback, CPSMatchConfidence


class HorrorBabbleSkill(MediaCollectionSkill):
class HorrorBabbleSkill(VideoCollectionSkill):

def __init__(self):
super().__init__("HorrorBabble")
self.supported_media = [CPSMatchType.GENERIC,
CPSMatchType.AUDIOBOOK,
CPSMatchType.VIDEO]

self.default_image = join(dirname(__file__), "ui", "bg.png")
self.skill_logo = join(dirname(__file__), "ui", "horrorbabble_icon.png")
self.skill_icon = join(dirname(__file__), "ui", "horrorbabble_icon.png")
self.default_bg = join(dirname(__file__), "ui", "bg.png")
path = join(dirname(__file__), "res", "HorrorBabble.jsondb")
logo = join(dirname(__file__), "res", "horrorbabble_logo.png")
# load video catalog
self.media_collection = Collection("HorrorBabble", logo=logo, db_path=path)
self.media_type = CPSMatchType.AUDIOBOOK
self.playback_type = CPSPlayback.AUDIO

def get_intro_message(self):
self.speak_dialog("intro")
Expand All @@ -31,34 +34,21 @@ 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.05
match = CPSMatchLevel.GENERIC

if self.voc_match(phrase, "audiobook") or\
media_type == CPSMatchType.AUDIOBOOK:
score += 0.1
match = CPSMatchLevel.CATEGORY
score += 10
if self.voc_match(phrase, "horror"):
score += 30
self.CPS_extend_timeout(1)

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

if self.voc_match(phrase, "horrorbabble"):
score += 0.3
match = CPSMatchLevel.TITLE
score += 80

return match, score

def calc_final_score(self, phrase, base_score, match_level):
score = base_score
if self.voc_match(phrase, "horrorbabble"):
score += 0.15
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.
1 change: 1 addition & 0 deletions locale/en-us/horror.voc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
horror
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
py_VOD>=0.3.1
json_database>=0.2.1
ovos_utils>=0.0.4rc2
youtube-dl
pafy
ovos_utils>=0.0.8a1
2 changes: 1 addition & 1 deletion res/desktop/skill-horrorbabble.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Terminal=false
Type=Application
Name=Horror Babble
Exec=mycroft-gui-app --hideTextInput --skill=skill-horrorbabble.jarbasskills.home
Icon=horrorbabble_icon
Icon=horrorbabble_icon.png
Categories=VoiceApp
StartupNotify=false
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": "HorrorBabble Skill",
"skillname": "skill-horrorbabble\"",
"authorname": "JarbasSkills",
"foldername": "",
"url": "https://github.com/JarbasSkills/skill-horrorbabble",
"branch": "v0.1",
"desktopFile": true,
"warning": "",
"systemDeps": false,
"platforms": [
"arm",
"arm64",
"i386",
"x86_64",
"ia64"
],
"examples": [
"open horror babble menu",
"play horror audio books"
]
}
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/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/horrorbabble_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 a92b6ed

Please sign in to comment.