Enforce default HTTP profile for slimproto players (#1611)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 25 Aug 2024 23:55:09 +0000 (01:55 +0200)
committerGitHub <noreply@github.com>
Sun, 25 Aug 2024 23:55:09 +0000 (01:55 +0200)
music_assistant/common/models/config_entries.py
music_assistant/server/controllers/streams.py
music_assistant/server/providers/slimproto/__init__.py
music_assistant/server/providers/ugp/__init__.py

index 46f0a4a5a8801f9c8a13a9762f1c55c25185e26d..fa42c0e2baf3f593989fefd66025fba8ee0d43fc 100644 (file)
@@ -610,6 +610,13 @@ CONF_ENTRY_HTTP_PROFILE = ConfigEntry(
     "'chunked transfer encoding', works just fine. \n\n",
 )
 
+CONF_ENTRY_HTTP_PROFILE_DEFAULT_2 = ConfigEntry.from_dict(
+    {**CONF_ENTRY_HTTP_PROFILE.to_dict(), "default_value": "no_content_length"}
+)
+CONF_ENTRY_HTTP_PROFILE_FORCED_2 = ConfigEntry.from_dict(
+    {**CONF_ENTRY_HTTP_PROFILE.to_dict(), "default_value": "no_content_length", "hidden": True}
+)
+
 
 def create_sample_rates_config_entry(
     max_sample_rate: int,
index 70416197e2f64def6e0a90f3c40070eca895d258..5322bc2cdedb181f78b65f33a5f921b4559e22d7 100644 (file)
@@ -266,8 +266,8 @@ class StreamsController(CoreController):
             default_sample_rate=queue_item.streamdetails.audio_format.sample_rate,
             default_bit_depth=queue_item.streamdetails.audio_format.bit_depth,
         )
-        http_profile: str = self.mass.config.get_raw_player_config_value(
-            queue_id, CONF_HTTP_PROFILE, "chunked"
+        http_profile: str = await self.mass.config.get_player_config_value(
+            queue_id, CONF_HTTP_PROFILE
         )
         # prepare request, add some DLNA/UPNP compatible headers
         headers = {
@@ -356,8 +356,8 @@ class StreamsController(CoreController):
         icy_meta_interval = 16384
 
         # prepare request, add some DLNA/UPNP compatible headers
-        http_profile: str = self.mass.config.get_raw_player_config_value(
-            queue_id, CONF_HTTP_PROFILE, "chunked"
+        http_profile: str = await self.mass.config.get_player_config_value(
+            queue_id, CONF_HTTP_PROFILE
         )
         # prepare request, add some DLNA/UPNP compatible headers
         headers = {
index 992b9033c480d4f0ab8ef3c7cd40faeaaa34b754..cf333a4d507af90bda8c8275c0c9e29c467e892a 100644 (file)
@@ -28,6 +28,7 @@ from music_assistant.common.models.config_entries import (
     CONF_ENTRY_EQ_BASS,
     CONF_ENTRY_EQ_MID,
     CONF_ENTRY_EQ_TREBLE,
+    CONF_ENTRY_HTTP_PROFILE_FORCED_2,
     CONF_ENTRY_OUTPUT_CHANNELS,
     CONF_ENTRY_SYNC_ADJUST,
     ConfigEntry,
@@ -317,6 +318,7 @@ class SlimprotoProvider(PlayerProvider):
                 CONF_ENTRY_SYNC_ADJUST,
                 CONF_ENTRY_DISPLAY,
                 CONF_ENTRY_VISUALIZATION,
+                CONF_ENTRY_HTTP_PROFILE_FORCED_2,
                 create_sample_rates_config_entry(int(slimclient.max_sample_rate), 24, 48000, 24),
             )
         )
index e4ca5febcce197616d1a9ef84f5b5af8ba3a3c35..b32ee34f977d3d10922d9057481a42a42adfe5d8 100644 (file)
@@ -371,8 +371,8 @@ class UniversalGroupProvider(PlayerProvider):
             bit_depth=stream.audio_format.bit_depth,
         )
 
-        http_profile: str = self.mass.config.get_raw_player_config_value(
-            child_player_id, CONF_HTTP_PROFILE, "chunked"
+        http_profile: str = await self.mass.config.get_player_config_value(
+            child_player_id, CONF_HTTP_PROFILE
         )
         headers = {
             **DEFAULT_STREAM_HEADERS,