From 23fd211edeb10e8131e819f6d8d9bdf067f6de81 Mon Sep 17 00:00:00 2001 From: David Trattnig <david.trattnig@o94.at> Date: Wed, 27 Jan 2021 22:05:24 +0100 Subject: [PATCH] Socket dir relative to project root. #72 --- config/sample-development.engine.ini | 12 +++++++----- config/sample-docker.engine.ini | 12 +++++++----- config/sample-production.engine.ini | 13 ++++++------- docs/developer-guide.md | 2 +- src/core/client/client.py | 2 +- tests/test.py | 4 ++-- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/config/sample-development.engine.ini b/config/sample-development.engine.ini index 754235e6..572b1dfa 100644 --- a/config/sample-development.engine.ini +++ b/config/sample-development.engine.ini @@ -1,8 +1,10 @@ +############################################## +# Engine Configuration # +############################################## -################### -# Engine Settings # -################### - +[general] +# Path to the engine-core socket directory relative to the engine project root +socket_dir="../engine-core/socket" [database] db_user="aura" @@ -112,7 +114,7 @@ daemongroup="engineuser" daemonuser="engineuser" [socket] -socketdir="/home/username/code/aura/engine/src/liquidsoap" +socket_dir="/home/username/code/aura/engine/src/liquidsoap" [audiosources] audio_source_folder="/var/audio/source" diff --git a/config/sample-docker.engine.ini b/config/sample-docker.engine.ini index 9552d343..51349fd3 100644 --- a/config/sample-docker.engine.ini +++ b/config/sample-docker.engine.ini @@ -1,8 +1,10 @@ +############################################## +# Engine Configuration # +############################################## -################### -# Engine Settings # -################### - +[general] +# Path to the engine-core socket directory relative to the engine project root +socket_dir="../engine-core/socket" [database] db_user="aura" @@ -112,7 +114,7 @@ daemongroup="engineuser" daemonuser="engineuser" [socket] -socketdir="/srv/src/liquidsoap" +socket_dir="/srv/src/liquidsoap" [audiosources] audio_source_folder="/var/audio/source" diff --git a/config/sample-production.engine.ini b/config/sample-production.engine.ini index 8f754aae..fd163e46 100644 --- a/config/sample-production.engine.ini +++ b/config/sample-production.engine.ini @@ -1,8 +1,10 @@ +############################################## +# Engine Configuration # +############################################## -################### -# Engine Settings # -################### - +[general] +# Path to the engine-core socket directory relative to the engine project root +socket_dir="../engine-core/socket" [database] db_user="aura" @@ -111,9 +113,6 @@ lqs_delay_offset=0.5 daemongroup="engineuser" daemonuser="engineuser" -[socket] -socketdir="/opt/aura/engine/src/liquidsoap" - [audiosources] audio_source_folder="/var/audio/source" audio_source_extension=".flac" diff --git a/docs/developer-guide.md b/docs/developer-guide.md index 10a6b7e9..358415ba 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -62,7 +62,7 @@ When you start Engine the following is happening: 1. Python `run.py`: Initializes `src/core/engine.py` (The virtual mixer; class for remote-controlling Liquidsoap), Scheduler 2. Python `run.py`: Start Liquidsoap. -3. Liquidsoap: When Liquidsoap finished its startup, it creates a socket file as configured in `socketdir` of `engine.ini`. +3. Liquidsoap: When Liquidsoap finished its startup, it creates a socket file as configured in `socket_dir` of `engine.ini`. 4. Python `src/core/liquidsoap/client.py`: Connects to that socket file. 5. Python `src/schedulung/scheduler.py`: Continously loads timeslots from the API endpoints, stores them in the local database and starts the playout as per the timeslots. diff --git a/src/core/client/client.py b/src/core/client/client.py index ff723b8b..d8ef758e 100644 --- a/src/core/client/client.py +++ b/src/core/client/client.py @@ -49,7 +49,7 @@ class LiquidSoapClient: @param socket_path: Der Pfad zum Socket des Liquidsoap-Scripts """ self.logger = logging.getLogger("AuraEngine") - self.socket_path = config.get('socketdir') + '/' + socket_filename + self.socket_path = config.get("install_dir") + "/" + config.get("socket_dir") + "/" + socket_filename self.logger.debug("LiquidSoapClient using socketpath: " + self.socket_path) diff --git a/tests/test.py b/tests/test.py index 76a539b2..12abd657 100644 --- a/tests/test.py +++ b/tests/test.py @@ -68,8 +68,8 @@ class TestConfig(unittest.TestCase): engine_health_url = self.config.get("api_engine_store_health").replace("${ENGINE_NUMBER}", "1") self.assertTrue(validators.url(engine_health_url)) - # Check if Liquidsoap "socketdir" is set and a directory - self.assertTrue(os.path.isdir(self.config.get("socketdir"))) + # Check if Liquidsoap "socket_dir" is set and a directory + self.assertTrue(os.path.isdir(self.config.get("socket_dir"))) # Check if database settings are set self.assertIsNotNone(self.config.get("db_user")) -- GitLab