Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed May 7, 2024
1 parent e736282 commit 4f82bf6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 126 deletions.
2 changes: 1 addition & 1 deletion ovos_workshop/decorators/ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
except ImportError:
from ovos_utils.log import LOG
from enum import IntEnum
LOG.warning("ovos-utils~=0.1 not installed. Patching missing imports")
LOG.warning("Please update to ovos-utils~=0.1. Patching missing imports")


class MediaType(IntEnum):
Expand Down
125 changes: 1 addition & 124 deletions ovos_workshop/skills/common_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,131 +13,8 @@

# backwards compat imports, do not delete, skills import from here
from ovos_workshop.decorators.ocp import ocp_play, ocp_next, ocp_pause, ocp_resume, ocp_search, \
ocp_previous, ocp_featured_media, MediaType, MediaState, MatchConfidence, \
ocp_previous, ocp_featured_media
try:
from ovos_utils.ocp import MediaType, MediaState, MatchConfidence, \
PlaybackType, PlaybackMode, PlayerState, LoopState, TrackState
except ImportError:
LOG.warning("ovos-utils~=0.1 not installed. Patching missing imports")
from enum import IntEnum

class MediaType(IntEnum):
GENERIC = 0 # nothing else matches
AUDIO = 1 # things like ambient noises
MUSIC = 2
VIDEO = 3 # eg, youtube videos
AUDIOBOOK = 4
GAME = 5 # because it shares the verb "play", mostly for disambguation
PODCAST = 6
RADIO = 7 # live radio
NEWS = 8 # news reports
TV = 9 # live tv stream
MOVIE = 10
TRAILER = 11
AUDIO_DESCRIPTION = 12 # narrated movie for the blind
VISUAL_STORY = 13 # things like animated comic books
BEHIND_THE_SCENES = 14
DOCUMENTARY = 15
RADIO_THEATRE = 16
SHORT_FILM = 17 # typically movies under 45 min
SILENT_MOVIE = 18
VIDEO_EPISODES = 19 # tv series etc
BLACK_WHITE_MOVIE = 20
CARTOON = 21
ANIME = 22
ASMR = 23

ADULT = 69 # for content filtering
HENTAI = 70 # for content filtering
ADULT_AUDIO = 71 # for content filtering


class MediaState(IntEnum):
# https://doc.qt.io/qt-5/qmediaplayer.html#MediaStatus-enum
# The status of the media cannot be determined.
UNKNOWN = 0
# There is no current media. PlayerState == STOPPED
NO_MEDIA = 1
# The current media is being loaded. The player may be in any state.
LOADING_MEDIA = 2
# The current media has been loaded. PlayerState== STOPPED
LOADED_MEDIA = 3
# Playback of the current media has stalled due to
# insufficient buffering or some other temporary interruption.
# PlayerState != STOPPED
STALLED_MEDIA = 4
# The player is buffering data but has enough data buffered
# for playback to continue for the immediate future.
# PlayerState != STOPPED
BUFFERING_MEDIA = 5
# The player has fully buffered the current media. PlayerState != STOPPED
BUFFERED_MEDIA = 6
# Playback has reached the end of the current media. PlayerState == STOPPED
END_OF_MEDIA = 7
# The current media cannot be played. PlayerState == STOPPED
INVALID_MEDIA = 8


class MatchConfidence(IntEnum):
EXACT = 95
VERY_HIGH = 90
HIGH = 80
AVERAGE_HIGH = 70
AVERAGE = 50
AVERAGE_LOW = 30
LOW = 15
VERY_LOW = 1


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 PlaybackMode(IntEnum):
AUTO = 0 # play each entry as considered appropriate,
# ie, make it happen the best way possible
AUDIO_ONLY = 10 # only consider audio entries
VIDEO_ONLY = 20 # only consider video entries
FORCE_AUDIO = 30 # cast video to audio unconditionally
FORCE_AUDIOSERVICE = 40 ## DEPRECATED - used in ovos 0.0.7
EVENTS_ONLY = 50 # only emit ocp events, do not display or play anything.
# allows integration with external interfaces


class PlayerState(IntEnum):
# https://doc.qt.io/qt-5/qmediaplayer.html#State-enum
STOPPED = 0
PLAYING = 1
PAUSED = 2


class LoopState(IntEnum):
NONE = 0
REPEAT = 1
REPEAT_TRACK = 2


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


def get_non_properties(obj):
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ovos-utils >= 0.0.38, < 0.2.0
ovos-bus-client < 0.1.0, >=0.0.9a17
ovos-bus-client < 0.1.0, >=0.0.9a20
ovos_config < 0.2.0,>=0.0.12
ovos_backend_client < 0.2.0, >=0.1.0
ovos-lingua-franca~=0.4, >=0.4.6
Expand Down

0 comments on commit 4f82bf6

Please sign in to comment.