Use new media player enums (#78264)

This commit is contained in:
epenet 2022-09-12 20:06:27 +02:00 committed by GitHub
parent 5e9c0399eb
commit 5c8e8e4860
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 445 additions and 609 deletions

View file

@ -11,8 +11,7 @@ from aiohttp.web_request import FileField
import voluptuous as vol
from homeassistant.components import http, websocket_api
from homeassistant.components.media_player.const import MEDIA_CLASS_DIRECTORY
from homeassistant.components.media_player.errors import BrowseError
from homeassistant.components.media_player import BrowseError, MediaClass
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import Unauthorized
from homeassistant.util import raise_if_invalid_filename, raise_if_invalid_path
@ -109,12 +108,12 @@ class LocalSource(MediaSource):
base = BrowseMediaSource(
domain=DOMAIN,
identifier="",
media_class=MEDIA_CLASS_DIRECTORY,
media_class=MediaClass.DIRECTORY,
media_content_type=None,
title=self.name,
can_play=False,
can_expand=True,
children_media_class=MEDIA_CLASS_DIRECTORY,
children_media_class=MediaClass.DIRECTORY,
)
base.children = [
@ -158,10 +157,10 @@ class LocalSource(MediaSource):
title = path.name
media_class = MEDIA_CLASS_DIRECTORY
media_class = MediaClass.DIRECTORY
if mime_type:
media_class = MEDIA_CLASS_MAP.get(
mime_type.split("/")[0], MEDIA_CLASS_DIRECTORY
mime_type.split("/")[0], MediaClass.DIRECTORY
)
media = BrowseMediaSource(