Skip to content

Commit

Permalink
Use MediaplayerEntityFeature and MediaType enums (#672)
Browse files Browse the repository at this point in the history
Co-authored-by: Pepijn Mistiaen <[email protected]>
Co-authored-by: Thomas Lovén <[email protected]>
  • Loading branch information
3 people authored Jul 31, 2024
1 parent c241257 commit 010807c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions custom_components/browser_mod/media_player.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from homeassistant.components import media_source
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player import (
MediaPlayerEntity,
MediaPlayerEntityFeature,
MediaType,
)
from homeassistant.components.media_player.browse_media import (
async_process_play_media_url,
)
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MUSIC,
MEDIA_TYPE_URL,
)
from homeassistant.const import (
STATE_UNAVAILABLE,
STATE_PAUSED,
Expand Down Expand Up @@ -113,7 +111,7 @@ async def async_play_media(self, media_type, media_id, **kwargs):
media_type = play_item.mime_type
media_id = play_item.url
media_id = async_process_play_media_url(self.hass, media_id)
if media_type in (MEDIA_TYPE_URL, MEDIA_TYPE_MUSIC):
if media_type in (MediaType.URL, MediaType.MUSIC):
media_id = async_process_play_media_url(self.hass, media_id)
await self.browser.send(
"player-play", media_content_id=media_id, media_type=media_type, **kwargs
Expand Down

0 comments on commit 010807c

Please sign in to comment.