from music_assistant.models.provider import Provider, ProviderType
from music_assistant.music_manager import MusicManager
from music_assistant.player_manager import PlayerManager
-from music_assistant.utils import callback, get_hostname, get_ip_pton, is_callback
+from music_assistant.utils import callback, get_ip_pton, is_callback
from music_assistant.web import Web
from zeroconf import NonUniqueNameException, ServiceInfo, Zeroconf
async def __async_setup_discovery(self):
"""Make this Music Assistant instance discoverable on the network."""
zeroconf_type = "_music-assistant._tcp.local."
+ discovery_info = self.web.discovery_info
+ name = discovery_info["id"].lower()
info = ServiceInfo(
zeroconf_type,
- name=f"{self.web.internal_url}.{zeroconf_type}",
- server=f"{get_hostname()}.local.",
+ name=f"{name}.{zeroconf_type}",
addresses=[get_ip_pton()],
- port=self.web.http_port,
- properties=self.web.discovery_info,
+ port=discovery_info["http_port"],
+ properties=discovery_info,
)
LOGGER.debug("Starting Zeroconf broadcast...")
try:
CONF_KEY_PLAYERSETTINGS,
CONF_KEY_PROVIDERS,
)
+from music_assistant.constants import __version__ as MASS_VERSION
from music_assistant.models.media_types import MediaType
from music_assistant.models.player_queue import QueueOption
from music_assistant.utils import get_external_ip, get_hostname, get_ip, json_serializer
web.get("/jsonrpc.js", self.async_json_rpc),
web.post("/jsonrpc.js", self.async_json_rpc),
web.get("/ws", self.async_websocket_handler),
+ web.get("/info", self.async_info),
]
)
webdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web/")
def discovery_info(self):
"""Return (discovery) info about this instance."""
return {
- "id": f"musicassistant_{get_hostname()}",
+ "id": f"{get_hostname()}",
"external_url": self.external_url,
"internal_url": self.internal_url,
- "version": 1,
+ "host": self.internal_ip,
+ "http_port": self.http_port,
+ "https_port": self.https_port,
+ "ssl_enabled": self._enable_ssl,
+ "version": MASS_VERSION,
}
@routes.post("/api/login")
return web.json_response(token_info, dumps=json_serializer)
return web.HTTPUnauthorized(body="Invalid username and/or password provided!")
- @routes.get("/info")
+ @routes.get("/api/info")
async def async_info(self, request):
# pylint: disable=unused-argument
"""Return (discovery) info about this instance."""