diff --git a/klangbecken/cli.py b/klangbecken/cli.py index de98caf..e2e68ef 100644 --- a/klangbecken/cli.py +++ b/klangbecken/cli.py @@ -397,6 +397,27 @@ def disable_expired_cmd(data_dir): [MetadataChange("weight", 0)], ) + # currently liquidsoap does not notify when the playlist changes + # solving this the dirty way, because we hope that liquidsoap supports + # inotify properly in newer version than 1.3.7 which would make reloading + # the playlist obsolete. + from .player import LiquidsoapClient + from os import environ + + if "KLANGBECKEN_PLAYER_SOCKET" in environ: + player_socket = environ["KLANGBECKEN_PLAYER_SOCKET"] + try: + with LiquidsoapClient(player_socket) as client: + client.command("jingles.reload") + except FileNotFoundError: + print(f"Could not communicate with Liquidsoap via socket {player_socket}") + exit(1) + else: + print( + "Liquidsoap player socket environment variable (KLANGBECKEN_PLAYER_SOCKET) is not defined." + ) + exit(1) + def main(): """Klangbecken audio playout system.