feat(media_player): BrowseMedia app directory — root lists the options apps map (curated TiviMate/Wholphin/Netflix/YouTube fallback), selection launches via play_media(app) (P4-2c)
This commit is contained in:
1 parent
034cb5c83d
commit
326f02cb59
3 files changed
+252
No files matched your search
@@ -50,6 +50,7 @@ class MediaPlayerEntityFeature(enum.IntFlag):
|
||||
VOLUME_MUTE = 8
|
||||
VOLUME_STEP = 16
|
||||
VOLUME_SET = 32
|
||||
BROWSE_MEDIA = 4096
|
||||
TURN_ON = 64
|
||||
TURN_OFF = 128
|
||||
PLAY_MEDIA = 256
|
||||
@@ -57,6 +58,36 @@ class MediaPlayerEntityFeature(enum.IntFlag):
|
||||
PREVIOUS_TRACK = 1024
|
||||
|
||||
|
||||
class MediaClass:
|
||||
APP = "app"
|
||||
DIRECTORY = "directory"
|
||||
|
||||
|
||||
class BrowseMediaSource:
|
||||
"""HA BrowseMedia shape used by the app directory tests."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
title,
|
||||
media_class,
|
||||
media_content_type,
|
||||
media_content_id,
|
||||
can_play,
|
||||
can_expand,
|
||||
children=None,
|
||||
thumbnail=None,
|
||||
):
|
||||
self.title = title
|
||||
self.media_class = media_class
|
||||
self.media_content_type = media_content_type
|
||||
self.media_content_id = media_content_id
|
||||
self.can_play = can_play
|
||||
self.can_expand = can_expand
|
||||
self.children = children or []
|
||||
self.thumbnail = thumbnail
|
||||
|
||||
|
||||
class MediaEntityManager:
|
||||
"""trivial stand-in for the HA platform internals we don't exercise."""
|
||||
|
||||
@@ -120,6 +151,9 @@ def install() -> None:
|
||||
mp.MediaPlayerEntity = MediaPlayerEntity
|
||||
mp.MediaPlayerDeviceClass = types.SimpleNamespace(TV="tv")
|
||||
mp.MediaPlayerEntityFeature = MediaPlayerEntityFeature
|
||||
mp.BrowseMedia = BrowseMediaSource # factory used as a constructor
|
||||
mp.BrowseMediaSource = BrowseMediaSource
|
||||
mp.MediaClass = MediaClass
|
||||
mp.MediaPlayerState = MediaPlayerState
|
||||
sys.modules["homeassistant.components.media_player"] = mp
|
||||
|
||||
|
||||
Reference in new issue
Block a user