Skip to content

Commit

Permalink
fix/ocp_pipeline_config (#480)
Browse files Browse the repository at this point in the history
filter_SEI option didnt account for using legacy audio service

config was also not being passed to the OCPPipeline

```javascript
{
  "intents": {
    "OCP": {
      // legacy forces old audio service instead of OCP
      "legacy": false,
      // min confidence to accept MediaType
      "classifier_threshold": 0.4,
      // filter results settings
      "min_score": 50,
      // filter results from "wrong" MediaType
      "filter_media": true,
      // filter results we lack plugins to play
      "filter_SEI": true,
      // playback mode -
      // 0 - auto
      // 10 - audio results only
      // 20 - video results only
      // 30 - cast video to audio unconditionally
      "playback_mode": 0,
      // if MediaType query fails, try Generic query
      "search_fallback": true,
      // enable mycroft common play pipeline
      "legacy_cps": true
    }
  }
}
```
  • Loading branch information
JarbasAl authored May 23, 2024
1 parent 01efc3d commit b7376c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ovos_core/intent_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _load_ocp_pipeline(self):
LOG.warning("EXPERIMENTAL: the OCP pipeline is enabled!")
try:
from ovos_core.intent_services.ocp_service import OCPPipelineMatcher
self.ocp = OCPPipelineMatcher(self.bus)
self.ocp = OCPPipelineMatcher(self.bus, config=self.config.get("OCP", {}))
except ImportError:
LOG.error("OCPPipelineMatcher unavailable, please install ovos-utils >= 0.1.0")

Expand Down
14 changes: 10 additions & 4 deletions ovos_core/intent_services/ocp_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ovos_bus_client.message import Message
from ovos_bus_client.util import wait_for_reply
from ovos_config import Configuration
from ovos_plugin_manager.ocp import load_stream_extractors
from ovos_plugin_manager.ocp import load_stream_extractors, available_extractors
from ovos_utils import classproperty
from ovos_utils.log import LOG
from ovos_utils.messagebus import FakeBus
Expand Down Expand Up @@ -115,7 +115,7 @@ def __init__(self, bus=None, config=None):
self.search_lock = RLock()
self.player_state = PlayerState.STOPPED.value
self.media_state = MediaState.UNKNOWN.value
self.available_SEI = []
self._available_SEI = []

self.intent_matchers = {}
self.skill_aliases = {
Expand Down Expand Up @@ -209,6 +209,12 @@ def register_ocp_intents(self):
self.bus.on("ocp:like_song", self.handle_like_intent)
self.bus.on("ocp:legacy_cps", self.handle_legacy_cps)

@property
def available_SEI(self):
if self.use_legacy_audio:
return available_extractors()
return self._available_SEI

def handle_get_SEIs(self, message: Message):
"""report available StreamExtractorIds
OCP plugins handle specific SEIs and return a real stream / extra metadata
Expand All @@ -223,7 +229,7 @@ def handle_get_SEIs(self, message: Message):
eg. for the youtube plugin a skill can return
"youtube//https://youtube.com/watch?v=wChqNkd6F24"
"""
self.available_SEI = message.data["SEI"]
self._available_SEI = message.data["SEI"]
LOG.info(f"Available stream extractor plugins: {self.available_SEI}")

def handle_skill_register(self, message: Message):
Expand Down Expand Up @@ -933,7 +939,7 @@ def match_legacy(self, utterances: List[str], lang: str, message: Message = None
legacy base class at mycroft/skills/common_play_skill.py marked for removal in ovos-core 0.1.0
"""
if not self.config.get("legacy_cps"):
if not self.config.get("legacy_cps", True):
# needs to be explicitly enabled in pipeline config
return None

Expand Down

0 comments on commit b7376c7

Please sign in to comment.