Skip to content

Commit

Permalink
bump OCP + setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Dec 29, 2021
1 parent 5993aa4 commit 5a7f4bf
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 24 deletions.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-include dialog *
recursive-include vocab *
recursive-include locale *
recursive-include res *
recursive-include ui *
50 changes: 26 additions & 24 deletions __init__.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import radiosoma
from ovos_utils.parse import fuzzy_match
from ovos_workshop.skills.common_play import OVOSCommonPlaybackSkill, \
MediaType, PlaybackType, ocp_search, MatchConfidence
MediaType, PlaybackType, ocp_search, MatchConfidence, ocp_featured_media


class SomaFMSkill(OVOSCommonPlaybackSkill):
Expand All @@ -14,34 +14,36 @@ def __init__(self):
MediaType.RADIO]
self.skill_icon = join(dirname(__file__), "ui", "somafm.png")

@ocp_featured_media()
def featured_media(self):
return [{
"match_confidence": 90,
"media_type": MediaType.RADIO,
"uri": ch.direct_stream,
"playback": PlaybackType.AUDIO,
"image": ch.image,
"bg_image": ch.image,
"skill_icon": self.skill_icon,
"title": ch.title,
"author": "SomaFM",
"length": 0
} for ch in radiosoma.get_stations()]

@ocp_search()
def ocp_somafm_playlist(self, phrase):
phrase = self.remove_voc(phrase, "radio")
if self.voc_match(phrase, "somafm", exact=True):
pl = [{
"match_confidence": 90,
yield {
"match_confidence": 100,
"media_type": MediaType.RADIO,
"uri": ch.direct_stream,
"playlist": self.featured_media(),
"playback": PlaybackType.AUDIO,
"image": ch.thumbnail_url,
"bg_image": ch.thumbnail_url,
"skill_icon": self.skill_icon,
"title": ch.title,
"author": "SomaFM",
"length": 0
} for ch in radiosoma.get_stations()]
if pl:
yield {
"match_confidence": 100,
"media_type": MediaType.RADIO,
"playlist": pl,
"playback": PlaybackType.AUDIO,
"skill_icon": self.skill_icon,
"image": "https://somafm.com/img3/LoneDJsquare400.jpg",
"bg_image": "https://somafm.com/about/pics/IMG_0974.jpg",
"title": "SomaFM (All stations)",
"author": "SomaFM"
}
"image": "https://somafm.com/img3/LoneDJsquare400.jpg",
"bg_image": "https://somafm.com/about/pics/IMG_0974.jpg",
"title": "SomaFM (All stations)",
"author": "SomaFM"
}

@ocp_search()
def search_somafm(self, phrase, media_type):
Expand Down Expand Up @@ -70,8 +72,8 @@ def search_somafm(self, phrase, media_type):
"media_type": MediaType.RADIO,
"uri": ch.direct_stream,
"playback": PlaybackType.AUDIO,
"image": ch.thumbnail_url,
"bg_image": ch.thumbnail_url,
"image": ch.image,
"bg_image": ch.image,
"skill_icon": self.skill_icon,
"title": ch.title,
"author": "SomaFM",
Expand Down
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
from setuptools import setup

# skill_id=package_name:SkillClass
PLUGIN_ENTRY_POINT = 'skill-somafm.jarbasai=skill_somafm:SomaFMSkill'

setup(
# this is the package name that goes on pip
name='ovos-skill-somafm',
version='0.0.1',
description='ovos somafm skill plugin',
url='https://github.com/JarbasSkills/skill-somafm',
author='JarbasAi',
author_email='[email protected]',
license='Apache-2.0',
package_dir={"skill_somafm": ""},
package_data={'skill_somafm': ['locale/*', 'ui/*', 'res/*']},
packages=['skill_somafm'],
include_package_data=True,
install_requires=["ovos_workshop~=0.0.5a1", "radiosoma"],
keywords='ovos skill plugin',
entry_points={'ovos.plugin.skill': PLUGIN_ENTRY_POINT}
)

0 comments on commit 5a7f4bf

Please sign in to comment.