From 0a6b5656518a8d8815f12f5725e9a032c2679d89 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Mon, 29 Dec 2025 15:06:48 -0500 Subject: [PATCH] Fix bug in op25 config where it would not create liquidsoap if saved config was loaded --- app/internal/op25_config_utls.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/app/internal/op25_config_utls.py b/app/internal/op25_config_utls.py index a4cedf3..96adfc1 100644 --- a/app/internal/op25_config_utls.py +++ b/app/internal/op25_config_utls.py @@ -3,9 +3,10 @@ import json import os import shutil from pathlib import Path -from models.models import TalkgroupTag +from models.models import TalkgroupTag, IcecastConfig from typing import List, Dict from internal.logger import create_logger +from internal.liquidsoap_config_utils import generate_liquid_script LOGGER = create_logger(__name__) @@ -65,7 +66,28 @@ def activate_config_from_library(system_name: str) -> bool: src_whitelist = src.with_suffix(".whitelist.tsv") if src_whitelist.exists(): shutil.copy2(src_whitelist, config_path / "active.cfg.whitelist.tsv") - + + # Generate Liquidsoap Script by reading the activated config + with open(dst, 'r') as f: + data = json.load(f) + + if "trunking" in data and "metadata" in data: + streams = data.get("metadata", {}).get("streams", []) + if streams: + stream = streams[0] + address = stream.get("icecastServerAddress", "127.0.0.1:8000") + host, port = address.split(":") if ":" in address else (address, 8000) + + ice_config = IcecastConfig( + icecast_host=host, + icecast_port=int(port), + icecast_mountpoint=stream.get("icecastMountpoint", "/stream"), + icecast_password=stream.get("icecastPass", "hackme"), + icecast_description="OP25 Stream", + icecast_genre="Scanner" + ) + generate_liquid_script(ice_config) + return True except Exception as e: LOGGER.error(f"Failed to copy config: {e}")