feat(playout): enable vorbis metadata per icecast output

Use new jinja template system to tweak the streams per output.
This commit is contained in:
jo 2023-02-25 20:14:30 +01:00 committed by Kyle Robbertze
parent 00b5c08647
commit a71606d39c
4 changed files with 11 additions and 33 deletions

View file

@ -2,7 +2,6 @@ from pathlib import Path
from typing import Optional, Tuple
from jinja2 import Environment, PackageLoader
from libretime_shared.config import AudioFormat
from ..config import Config
from .models import Info, StreamPreferences
@ -33,23 +32,13 @@ def generate_entrypoint(
if log_filepath is not None:
paths["log_filepath"] = log_filepath.resolve()
config = config.copy()
# Global icecast_vorbis_metadata until it is
# handled per output
icecast_vorbis_metadata = any(
o.enabled and o.audio.format == AudioFormat.OGG and o.audio.enable_metadata # type: ignore
for o in config.stream.outputs.icecast
)
entrypoint_filepath.write_text(
templates.get_template("entrypoint.liq.j2").render(
config=config,
config=config.copy(),
preferences=preferences,
info=info,
paths=paths,
version=version,
icecast_vorbis_metadata=icecast_vorbis_metadata,
),
encoding="utf-8",
)