Skip to content
Snippets Groups Projects
Commit ca010c18 authored by David Trattnig's avatar David Trattnig
Browse files

Allow connection outsite of player. #39

parent 5ba8519c
No related branches found
No related tags found
No related merge requests found
...@@ -80,7 +80,7 @@ class Engine(): ...@@ -80,7 +80,7 @@ class Engine():
""" """
self.event_dispatcher = EngineEventDispatcher(self) self.event_dispatcher = EngineEventDispatcher(self)
self.eci = EngineControlInterface(self, self.event_dispatcher) self.eci = EngineControlInterface(self, self.event_dispatcher)
self.player = Player(self.config, self.event_dispatcher) self.connector = PlayerConnector(self.event_dispatcher)
self.event_dispatcher.on_initialized() self.event_dispatcher.on_initialized()
while not self.is_connected(): while not self.is_connected():
...@@ -88,6 +88,7 @@ class Engine(): ...@@ -88,6 +88,7 @@ class Engine():
time.sleep(2) time.sleep(2)
self.logger.info(SU.green("Engine Core ------[ connected ]-------- Liquidsoap")) self.logger.info(SU.green("Engine Core ------[ connected ]-------- Liquidsoap"))
self.player = Player(self.connector, self.event_dispatcher)
self.event_dispatcher.on_boot() self.event_dispatcher.on_boot()
self.logger.info(EngineSplash.splash_screen("Engine Core", meta.__version__)) self.logger.info(EngineSplash.splash_screen("Engine Core", meta.__version__))
self.event_dispatcher.on_ready() self.event_dispatcher.on_ready()
...@@ -119,7 +120,7 @@ class Engine(): ...@@ -119,7 +120,7 @@ class Engine():
""" """
Retrieves the state of all inputs and outputs. Retrieves the state of all inputs and outputs.
""" """
state = self.player.connector.send_lqc_command("engine", "state") state = self.connector.send_lqc_command("engine", "state")
return state return state
...@@ -127,7 +128,7 @@ class Engine(): ...@@ -127,7 +128,7 @@ class Engine():
""" """
Get the version of Liquidsoap. Get the version of Liquidsoap.
""" """
data = self.player.connector.send_lqc_command("version", "") data = self.connector.send_lqc_command("version", "")
return data return data
...@@ -135,9 +136,9 @@ class Engine(): ...@@ -135,9 +136,9 @@ class Engine():
""" """
Retrieves the uptime of Liquidsoap. Retrieves the uptime of Liquidsoap.
""" """
self.player.connector.enable_transaction() self.connector.enable_transaction()
data = self.player.connector.send_lqc_command("uptime", "") data = self.connector.send_lqc_command("uptime", "")
self.player.connector.disable_transaction() self.connector.disable_transaction()
return data return data
...@@ -192,17 +193,17 @@ class Player: ...@@ -192,17 +193,17 @@ class Player:
def __init__(self, config, event_dispatcher): def __init__(self, connector, event_dispatcher):
""" """
Constructor Constructor
Args: Args:
config (AuraConfig): The configuration config (AuraConfig): The configuration
""" """
self.config = config self.config = AuraConfig.config()
self.logger = logging.getLogger("AuraEngine") self.logger = logging.getLogger("AuraEngine")
self.event_dispatcher = event_dispatcher self.event_dispatcher = event_dispatcher
self.connector = PlayerConnector(self.config, self.event_dispatcher) self.connector = connector
self.channel_router = ChannelRouter(self.config, self.logger) self.channel_router = ChannelRouter(self.config, self.logger)
self.mixer = Mixer(self.config, MixerType.MAIN, self.connector) self.mixer = Mixer(self.config, MixerType.MAIN, self.connector)
self.mixer_fallback = Mixer(self.config, MixerType.FALLBACK, self.connector) self.mixer_fallback = Mixer(self.config, MixerType.FALLBACK, self.connector)
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
import logging import logging
import time import time
from modules.base.config import AuraConfig
from modules.base.utils import TerminalColors, SimpleUtil as SU from modules.base.utils import TerminalColors, SimpleUtil as SU
from modules.base.exceptions import LQConnectionError from modules.base.exceptions import LQConnectionError
from modules.core.liquidsoap.playerclient import LiquidSoapPlayerClient from modules.core.liquidsoap.playerclient import LiquidSoapPlayerClient
...@@ -39,16 +40,16 @@ class PlayerConnector(): ...@@ -39,16 +40,16 @@ class PlayerConnector():
def __init__(self, config, event_dispatcher): def __init__(self, event_dispatcher):
""" """
Constructor Constructor
Args: Args:
config (AuraConfig): The configuration config (AuraConfig): The configuration
""" """
self.config = config self.config = AuraConfig.config()
self.logger = logging.getLogger("AuraEngine") self.logger = logging.getLogger("AuraEngine")
self.client = LiquidSoapPlayerClient(config, "engine.sock") self.client = LiquidSoapPlayerClient(self.config, "engine.sock")
self.event_dispatcher = event_dispatcher self.event_dispatcher = event_dispatcher
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment