Skip to content

Commit

Permalink
fix(cli): reload jingles playlist in liquidsoap after expiring
Browse files Browse the repository at this point in the history
  • Loading branch information
spameier committed Nov 5, 2023
1 parent bf98b63 commit a88c319
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions klangbecken/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a88c319

Please sign in to comment.