Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for ovos-utils 0.0.X compat. #224

Merged
merged 6 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions ovos_plugin_manager/templates/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,42 @@

from ovos_plugin_manager.templates.media import AudioPlayerBackend as _AB
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
from ovos_utils import classproperty
from ovos_utils.log import log_deprecation
from ovos_utils.ocp import PlaybackType, TrackState
from ovos_utils.log import LOG, log_deprecation
from ovos_utils.process_utils import RuntimeRequirements

try:
from ovos_utils.ocp import PlaybackType, TrackState
except ImportError:
LOG.warning("Please update to ovos-utils~=0.1.")
from enum import IntEnum

class PlaybackType(IntEnum):
SKILL = 0 # skills handle playback whatever way they see fit,
# eg spotify / mycroft common play
VIDEO = 1 # Video results
AUDIO = 2 # Results should be played audio only
AUDIO_SERVICE = 3 ## DEPRECATED - used in ovos 0.0.7
MPRIS = 4 # External MPRIS compliant player
WEBVIEW = 5 # webview, render a url instead of media player
UNDEFINED = 100 # data not available, hopefully status will be updated soon..


class TrackState(IntEnum):
DISAMBIGUATION = 1 # media result, not queued for playback
PLAYING_SKILL = 20 # Skill is handling playback internally
PLAYING_AUDIOSERVICE = 21 ## DEPRECATED - used in ovos 0.0.7
PLAYING_VIDEO = 22 # Skill forwarded playback to video service
PLAYING_AUDIO = 23 # Skill forwarded playback to audio service
PLAYING_MPRIS = 24 # External media player is handling playback
PLAYING_WEBVIEW = 25 # Media playback handled in browser (eg. javascript)

QUEUED_SKILL = 30 # Waiting playback to be handled inside skill
QUEUED_AUDIOSERVICE = 31 ## DEPRECATED - used in ovos 0.0.7
QUEUED_VIDEO = 32 # Waiting playback in video service
QUEUED_AUDIO = 33 # Waiting playback in audio service
QUEUED_WEBVIEW = 34 # Waiting playback in browser service


log_deprecation("ovos_plugin_manager.templates.audio has been deprecated on ovos-audio, "
"move to ovos_plugin_manager.templates.media", "0.1.0")

Expand Down
7 changes: 6 additions & 1 deletion ovos_plugin_manager/templates/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
from ovos_utils.log import LOG
from ovos_utils.messagebus import FakeBus

from ovos_utils.ocp import MediaState, PlayerState, TrackState
try:
from ovos_utils.ocp import MediaState, PlayerState, TrackState
except ImportError:
MediaState, PlayerState, TrackState = None, None, None
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved


class MediaBackend(metaclass=ABCMeta):
Expand All @@ -18,6 +21,8 @@ class MediaBackend(metaclass=ABCMeta):
"""

def __init__(self, config=None, bus=None):
if MediaState is None:
raise RuntimeError("Please update to ovos-utils~=0.1.")
self._now_playing = None # single uri
self._track_start_callback = None
self.supports_mime_hints = False
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ovos-utils < 0.2.0, >=0.1.0a8
ovos-utils < 0.2.0, >=0.0.38
ovos-bus-client < 0.2.0, >=0.0.9a3
ovos-config < 0.2.0, >=0.0.12
combo_lock~=0.2
Expand Down
3 changes: 2 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pytest
pytest-timeout
pytest-cov
ovos-translate-server-plugin
ovos-translate-server-plugin
ovos-utils>=0.1.0a8
Loading