Skip to content

Commit e45aa9b

Browse files
committed
update discovery infos
1 parent 955a3db commit e45aa9b

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

music_assistant/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""All constants for Music Assistant."""
22

3-
__version__ = "0.0.29"
3+
__version__ = "0.0.30"
44
REQUIRED_PYTHON_VER = "3.7"
55

66
CONF_USERNAME = "username"

music_assistant/mass.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from music_assistant.models.provider import Provider, ProviderType
2323
from music_assistant.music_manager import MusicManager
2424
from music_assistant.player_manager import PlayerManager
25-
from music_assistant.utils import callback, get_hostname, get_ip_pton, is_callback
25+
from music_assistant.utils import callback, get_ip_pton, is_callback
2626
from music_assistant.web import Web
2727
from zeroconf import NonUniqueNameException, ServiceInfo, Zeroconf
2828

@@ -248,13 +248,14 @@ def __handle_exception(loop, context):
248248
async def __async_setup_discovery(self):
249249
"""Make this Music Assistant instance discoverable on the network."""
250250
zeroconf_type = "_music-assistant._tcp.local."
251+
discovery_info = self.web.discovery_info
252+
name = discovery_info["id"].lower()
251253
info = ServiceInfo(
252254
zeroconf_type,
253-
name=f"{self.web.internal_url}.{zeroconf_type}",
254-
server=f"{get_hostname()}.local.",
255+
name=f"{name}.{zeroconf_type}",
255256
addresses=[get_ip_pton()],
256-
port=self.web.http_port,
257-
properties=self.web.discovery_info,
257+
port=discovery_info["http_port"],
258+
properties=discovery_info,
258259
)
259260
LOGGER.debug("Starting Zeroconf broadcast...")
260261
try:

music_assistant/web.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
CONF_KEY_PLAYERSETTINGS,
2020
CONF_KEY_PROVIDERS,
2121
)
22+
from music_assistant.constants import __version__ as MASS_VERSION
2223
from music_assistant.models.media_types import MediaType
2324
from music_assistant.models.player_queue import QueueOption
2425
from music_assistant.utils import get_external_ip, get_hostname, get_ip, json_serializer
@@ -143,6 +144,7 @@ async def async_setup(self):
143144
web.get("/jsonrpc.js", self.async_json_rpc),
144145
web.post("/jsonrpc.js", self.async_json_rpc),
145146
web.get("/ws", self.async_websocket_handler),
147+
web.get("/info", self.async_info),
146148
]
147149
)
148150
webdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web/")
@@ -217,10 +219,14 @@ def external_url(self):
217219
def discovery_info(self):
218220
"""Return (discovery) info about this instance."""
219221
return {
220-
"id": f"musicassistant_{get_hostname()}",
222+
"id": f"{get_hostname()}",
221223
"external_url": self.external_url,
222224
"internal_url": self.internal_url,
223-
"version": 1,
225+
"host": self.internal_ip,
226+
"http_port": self.http_port,
227+
"https_port": self.https_port,
228+
"ssl_enabled": self._enable_ssl,
229+
"version": MASS_VERSION,
224230
}
225231

226232
@routes.post("/api/login")
@@ -234,7 +240,7 @@ async def async_login(self, request):
234240
return web.json_response(token_info, dumps=json_serializer)
235241
return web.HTTPUnauthorized(body="Invalid username and/or password provided!")
236242

237-
@routes.get("/info")
243+
@routes.get("/api/info")
238244
async def async_info(self, request):
239245
# pylint: disable=unused-argument
240246
"""Return (discovery) info about this instance."""

0 commit comments

Comments
 (0)