Commit ca010c18 authored by David Trattnig's avatar David Trattnig
Browse files

Allow connection outsite of player. #39

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