Files
nix-config/patches/music-assistant-zeroconf-port.patch

41 lines
1.8 KiB
Diff

diff --git a/music_assistant/providers/spotify_connect/__init__.py b/music_assistant/providers/spotify_connect/__init__.py
index 1111111..2222222 100644
--- a/music_assistant/providers/spotify_connect/__init__.py
+++ b/music_assistant/providers/spotify_connect/__init__.py
@@ -51,6 +51,7 @@ CONNECT_ITEM_ID = "spotify_connect"
CONF_PUBLISH_NAME = "publish_name"
CONF_ALLOW_PLAYER_SWITCH = "allow_player_switch"
+CONF_ZEROCONF_PORT = "zeroconf_port"
# Special value for auto player selection
PLAYER_ID_AUTO = "__auto__"
@@ -117,6 +118,15 @@ async def get_config_entries(
description="How should this Spotify Connect device be named in the Spotify app?",
default_value="Music Assistant",
),
+ ConfigEntry(
+ key=CONF_ZEROCONF_PORT,
+ type=ConfigEntryType.INTEGER,
+ label="Zeroconf port",
+ description="Fixed TCP port for Spotify Connect discovery (zeroconf). "
+ "Set to a specific port and open it in your firewall to allow "
+ "devices on the network to discover this player. 0 = random port.",
+ default_value=0,
+ ),
# ConfigEntry(
# key=CONF_HANDOFF_MODE,
# type=ConfigEntryType.BOOLEAN,
@@ -677,6 +687,11 @@ class SpotifyConnectProvider(PluginProvider):
"--onevent",
str(EVENTS_SCRIPT),
"--emit-sink-events",
+ *(
+ ["--zeroconf-port", str(zeroconf_port)]
+ if (zeroconf_port := int(self.config.get_value(CONF_ZEROCONF_PORT) or 0)) > 0
+ else []
+ ),
]
self._librespot_proc = librespot = AsyncProcess(
args, stdout=False, stderr=True, name=f"librespot[{self.name}]", env=env