From 45fc0c4f52e59275abd271d1beab2ef2d4a86440 Mon Sep 17 00:00:00 2001 From: Jozef Kruszynski Date: Mon, 18 Nov 2024 06:47:21 +0100 Subject: [PATCH] Move values to const.py --- custom_components/mass/const.py | 5 +++++ custom_components/mass/intent.py | 4 ++-- custom_components/mass/media_player.py | 15 +++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/custom_components/mass/const.py b/custom_components/mass/const.py index 703a04e8..85d8b9c5 100644 --- a/custom_components/mass/const.py +++ b/custom_components/mass/const.py @@ -17,10 +17,15 @@ ATTR_GROUP_LEADER = "group_leader" ATTR_MASS_PLAYER_ID = "mass_player_id" ATTR_MASS_PLAYER_TYPE = "mass_player_type" +ATTR_MEDIA_ID = "media_id" +ATTR_MEDIA_TYPE = "media_type" +ATTR_RADIO_MODE = "radio_mode" ATTR_STREAM_TITLE = "stream_title" CONF_OPENAI_AGENT_ID = "openai_agent_id" CONF_ASSIST_AUTO_EXPOSE_PLAYERS = "expose_players_assist" CONF_PRE_ANNOUNCE_TTS = "pre_announce_tts" +SERVICE_PLAY_MEDIA_ADVANCED = "play_media" + LOGGER = logging.getLogger(__package__) diff --git a/custom_components/mass/intent.py b/custom_components/mass/intent.py index 89f34d57..a04be091 100644 --- a/custom_components/mass/intent.py +++ b/custom_components/mass/intent.py @@ -31,8 +31,8 @@ from music_assistant_models.media_items import MediaItemType from . import DOMAIN -from .const import CONF_OPENAI_AGENT_ID -from .media_player import ( +from .const import ( + CONF_OPENAI_AGENT_ID, ATTR_MEDIA_ID, ATTR_MEDIA_TYPE, ATTR_RADIO_MODE, diff --git a/custom_components/mass/media_player.py b/custom_components/mass/media_player.py index 65040e6d..8d66fd80 100644 --- a/custom_components/mass/media_player.py +++ b/custom_components/mass/media_player.py @@ -49,7 +49,15 @@ from music_assistant_models.event import MassEvent from music_assistant_models.media_items import ItemMapping, MediaItemType, Track -from .const import ATTR_ACTIVE_QUEUE, ATTR_MASS_PLAYER_TYPE, DOMAIN +from .const import ( + ATTR_ACTIVE_QUEUE, + ATTR_MASS_PLAYER_TYPE, + DOMAIN, + ATTR_RADIO_MODE, + ATTR_MEDIA_ID, + ATTR_MEDIA_TYPE, + SERVICE_PLAY_MEDIA_ADVANCED, +) from .entity import MusicAssistantBaseEntity from .media_browser import async_browse_media @@ -87,14 +95,9 @@ MediaPlayerEnqueue.PLAY: QueueOption.PLAY, MediaPlayerEnqueue.REPLACE: QueueOption.REPLACE, } - -SERVICE_PLAY_MEDIA_ADVANCED = "play_media" SERVICE_PLAY_ANNOUNCEMEMT = "play_announcement" SERVICE_TRANSFER_QUEUE = "transfer_queue" SERVICE_GET_QUEUE = "get_queue" -ATTR_RADIO_MODE = "radio_mode" -ATTR_MEDIA_ID = "media_id" -ATTR_MEDIA_TYPE = "media_type" ATTR_ARTIST = "artist" ATTR_ALBUM = "album" ATTR_URL = "url"