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",
)

View File

@ -8,9 +8,6 @@ input_main_port = {{ config.stream.inputs.main.port }}
input_show_mount = {{ config.stream.inputs.show.mount | quote }}
input_show_port = {{ config.stream.inputs.show.port }}
# Outputs
icecast_vorbis_metadata = {{ icecast_vorbis_metadata | lower }}
# Settings
auth_path = {{ paths.auth_filepath | quote }}

View File

@ -53,6 +53,12 @@ output_icecast_{{ output_id }}_source = s
output_icecast_{{ output_id }}_source = mean(s)
{% endif -%}
{#- Add per output stream modifications. -#}
{% if output.audio.format == "ogg" and not output.audio.enable_metadata -%}
# Disable ogg metadata
output_icecast_{{ output_id }}_source = add(normalize=false, [amplify(0.00001, noise()), output_icecast_{{ output_id }}_source])
{% endif -%}
output.icecast(
id="icecast:{{ output_id }}",
host={{ output.host | quote }},

View File

@ -11,9 +11,6 @@
input_show_mount = "show"
input_show_port = 8002
# Outputs
icecast_vorbis_metadata = false
# Settings
auth_path = "/fake/liquidsoap_auth.py"
@ -51,9 +48,6 @@
input_show_mount = "show"
input_show_port = 8002
# Outputs
icecast_vorbis_metadata = false
# Settings
auth_path = "/fake/liquidsoap_auth.py"
@ -75,6 +69,8 @@
# icecast:1
output_icecast_1_source = s
# Disable ogg metadata
output_icecast_1_source = add(normalize=false, [amplify(0.00001, noise()), output_icecast_1_source])
output.icecast(
id="icecast:1",
host="localhost",
@ -114,9 +110,6 @@
input_show_mount = "show"
input_show_port = 8002
# Outputs
icecast_vorbis_metadata = false
# Settings
auth_path = "/fake/liquidsoap_auth.py"
@ -175,9 +168,6 @@
input_show_mount = "show"
input_show_port = 8002
# Outputs
icecast_vorbis_metadata = false
# Settings
auth_path = "/fake/liquidsoap_auth.py"
@ -199,6 +189,8 @@
# icecast:1
output_icecast_1_source = s
# Disable ogg metadata
output_icecast_1_source = add(normalize=false, [amplify(0.00001, noise()), output_icecast_1_source])
output.icecast(
id="icecast:1",
host="localhost",
@ -259,9 +251,6 @@
input_show_mount = "show"
input_show_port = 8002
# Outputs
icecast_vorbis_metadata = false
# Settings
auth_path = "/fake/liquidsoap_auth.py"
@ -306,9 +295,6 @@
input_show_mount = "show"
input_show_port = 8002
# Outputs
icecast_vorbis_metadata = false
# Settings
auth_path = "/fake/liquidsoap_auth.py"