Skip to content

Commit

Permalink
Update audioservice.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Dec 28, 2023
1 parent 28045cc commit 4c96062
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ovos_utils/skills/audioservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,30 @@ def is_playing(self):
return self.track_info() != {}


class OCPInterface(AudioServiceInterface):
class OCPInterface:
"""bus api interface for OCP subsystem
Args:
bus: Mycroft messagebus connection
"""

def __init__(self, bus=None):
self.bus = bus or get_mycroft_bus()


def _format_msg(self, msg_type, msg_data=None):
# this method ensures all skills are .forward from the utterance
# that triggered the skill, this ensures proper routing and metadata
msg_data = msg_data or {}
msg = dig_for_message()
if msg:
msg = msg.forward(msg_type, msg_data)
else:
msg = Message(msg_type, msg_data)
# at this stage source == skills, lets indicate audio service took over
sauce = msg.context.get("source")
if sauce == "skills":
msg.context["source"] = "audio_service"
return msg

# OCP bus api
def queue(self, tracks):
"""Queue up a track to OCP playing playlist.
Expand Down

0 comments on commit 4c96062

Please sign in to comment.