From 0880d8298d98ead5d9dafc9b5e37e9f3e4c01db8 Mon Sep 17 00:00:00 2001
From: martina <martina@freirad.at>
Date: Wed, 2 Oct 2024 15:18:40 +0200
Subject: [PATCH] Breaking Change: rename audio channels

---
 src/aura_engine/core/channels.py | 10 +++++-----
 src/aura_engine/resources.py     |  4 ++--
 tests/core_client_mock.py        |  2 +-
 tests/test_core_mixer.py         |  6 +++---
 tests/test_engine_resources.py   | 10 +++++-----
 tests/test_plugins_monitor.py    |  6 +++---
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/aura_engine/core/channels.py b/src/aura_engine/core/channels.py
index 3bb362a7..87c98d11 100644
--- a/src/aura_engine/core/channels.py
+++ b/src/aura_engine/core/channels.py
@@ -59,11 +59,11 @@ class ChannelName(str, Enum):
     QUEUE_B = "in_queue_1"
     HTTP_A = "in_stream_0"
     HTTP_B = "in_stream_1"
-    LIVE_0 = "in_line_0"
-    LIVE_1 = "in_line_1"
-    LIVE_2 = "in_line_2"
-    LIVE_3 = "in_line_3"
-    LIVE_4 = "in_line_4"
+    LIVE_0 = "aura_engine_line_in_0"
+    LIVE_1 = "aura_engine_line_in_1"
+    LIVE_2 = "aura_engine_line_in_2"
+    LIVE_3 = "aura_engine_line_in_3"
+    LIVE_4 = "aura_engine_line_in_4"
     FALLBACK_FOLDER = "fallback_folder"
     FALLBACK_PLAYLIST = "fallback_playlist"
 
diff --git a/src/aura_engine/resources.py b/src/aura_engine/resources.py
index 8ee53f85..cb43ccfc 100644
--- a/src/aura_engine/resources.py
+++ b/src/aura_engine/resources.py
@@ -78,7 +78,7 @@ class ResourceMapping:
         Return the channel enum for a given live channel string from Tank.
 
         Channel URIs from Tank are typically in the format `line://1`, while
-        channel names in Liquidsoap have names in the format `in_line_1`.
+        channel names in Liquidsoap have names in the format `aura_engine_line_in_1`.
 
         If no valid channel URI is provided, `None` is returned.
 
@@ -90,7 +90,7 @@ class ResourceMapping:
         """
         if not channel_uri:
             return None
-        channel_name = "in_line_" + channel_uri.split("line://")[1]
+        channel_name = "aura_engine_line_in_" + channel_uri.split("line://")[1]
 
         for cn in ChannelName:
             if cn.value == channel_name:
diff --git a/tests/core_client_mock.py b/tests/core_client_mock.py
index 6372061d..8046ef99 100644
--- a/tests/core_client_mock.py
+++ b/tests/core_client_mock.py
@@ -142,7 +142,7 @@ class CoreClientMock(CoreClient):
                     case MixerAction.INPUTS:
                         response = f"{ChannelName.QUEUE_A} {ChannelName.QUEUE_B} {ChannelName.HTTP_A} {ChannelName.HTTP_B} {ChannelName.LIVE_0} {ChannelName.LIVE_1}"
                     case MixerAction.OUTPUTS:
-                        response = '["lineout_0", "out_http_0"]'  # no abstraction yet
+                        response = '["aura_engine_line_out_0", "out_http_0"]'  # no abstraction yet
                     case MixerAction.STATUS:
                         chn = int(args)
                         vol = self.volumes[chn]
diff --git a/tests/test_core_mixer.py b/tests/test_core_mixer.py
index 8934fe83..edd2da08 100644
--- a/tests/test_core_mixer.py
+++ b/tests/test_core_mixer.py
@@ -66,14 +66,14 @@ class TestMixer(unittest.TestCase):
         self.assertEqual(inputs["in_queue_1"], input_state)
         self.assertEqual(inputs["in_stream_0"], input_state)
         self.assertEqual(inputs["in_stream_1"], input_state)
-        self.assertEqual(inputs["in_line_0"], input_state)
-        self.assertEqual(inputs["in_line_1"], input_state)
+        self.assertEqual(inputs["aura_engine_line_in_0"], input_state)
+        self.assertEqual(inputs["aura_engine_line_in_1"], input_state)
 
     def test_get_outputs(self):
         print(self._testMethodName)
         outputs = self.mixer.get_outputs()
         self.assertEqual(len(outputs), 2)
-        self.assertEqual(outputs[0], "lineout_0")
+        self.assertEqual(outputs[0], "aura_engine_line_out_0")
         self.assertEqual(outputs[1], "out_http_0")
 
     def test_get_free_channel(self):
diff --git a/tests/test_engine_resources.py b/tests/test_engine_resources.py
index 2ab1cd95..71d90f04 100644
--- a/tests/test_engine_resources.py
+++ b/tests/test_engine_resources.py
@@ -92,19 +92,19 @@ class TestEngineResources(unittest.TestCase):
         rm = ResourceMapping()
         live_channel: ChannelName = rm.live_channel_for_resource("line://0")
         self.assertEqual("LIVE_0", live_channel.name)
-        self.assertEqual("in_line_0", live_channel.value)
+        self.assertEqual("aura_engine_line_in_0", live_channel.value)
         live_channel: ChannelName = rm.live_channel_for_resource("line://1")
         self.assertEqual("LIVE_1", live_channel.name)
-        self.assertEqual("in_line_1", live_channel.value)
+        self.assertEqual("aura_engine_line_in_1", live_channel.value)
         live_channel: ChannelName = rm.live_channel_for_resource("line://2")
         self.assertEqual("LIVE_2", live_channel.name)
-        self.assertEqual("in_line_2", live_channel.value)
+        self.assertEqual("aura_engine_line_in_2", live_channel.value)
         live_channel: ChannelName = rm.live_channel_for_resource("line://3")
         self.assertEqual("LIVE_3", live_channel.name)
-        self.assertEqual("in_line_3", live_channel.value)
+        self.assertEqual("aura_engine_line_in_3", live_channel.value)
         live_channel: ChannelName = rm.live_channel_for_resource("line://4")
         self.assertEqual("LIVE_4", live_channel.name)
-        self.assertEqual("in_line_4", live_channel.value)
+        self.assertEqual("aura_engine_line_in_4", live_channel.value)
 
     def test_resource_class(self):
         print(self._testMethodName)
diff --git a/tests/test_plugins_monitor.py b/tests/test_plugins_monitor.py
index 205fe0a2..03bcb743 100644
--- a/tests/test_plugins_monitor.py
+++ b/tests/test_plugins_monitor.py
@@ -46,12 +46,12 @@ class MockedMixer:
             "in_queue_1": state,
             "in_stream_0": state,
             "in_stream_1": state,
-            "in_line_0": state,
-            "in_line_1": state,
+            "aura_engine_line_in_0": state,
+            "aura_engine_line_in_1": state,
         }
 
     def get_outputs(self) -> list:
-        return ["lineout_0", "out_http_0"]
+        return ["aura_engine_line_out_0", "out_http_0"]
 
 
 class MockedPlayer:
-- 
GitLab