fixed stalling queues

This commit is contained in:
G. Gibson 2026-09-01 11:43:47 -07:00
commit 986929cb4e

View file

@ -6,6 +6,12 @@
# relative config.json path resolves correctly; media lives under # relative config.json path resolves correctly; media lives under
# the storage path read from that file. Directory playlists scan # the storage path read from that file. Directory playlists scan
# recursively for audio files automatically. # recursively for audio files automatically.
#
# JINGLE/ANNOUNCEMENT NOTE:
# random() stalls when one branch is permanently down (empty dir).
# Until jingles/announcements directories contain audio files,
# they are excluded from the graph. Uncomment the relevant lines
# below once you've added content to those folders.
# --------------------------------------------------------------- # ---------------------------------------------------------------
set("log.stdout", true) set("log.stdout", true)
@ -38,52 +44,28 @@ set("log.file.path", "#{storage}/logs/liquidsoap.log")
# --- Background music library (directory scanned recursively) -- # --- Background music library (directory scanned recursively) --
music_playlist = music_playlist =
playlist("#{storage}/music") mksafe(playlist("#{storage}/music"))
# --- Scheduled content: request queue fed by schedule.txt ------ # --- Scheduled content: request queue fed by schedule.txt ------
sched_queue = request.queue(id="scheduler") sched_queue = request.queue(id="scheduler")
# --- Helper: check if a directory contains any audio files ----- # --- Jingles / announcements (uncomment when dirs have content) ---
def has_audio(dir) = # jingles_src =
try # mksafe(playlist("#{storage}/jingles"))
let entries = file.ls(dir) #
let audio_count = list.length( # announcements_src =
list.filter(fun(f) -> regexp("\\.(mp3|m4a)$").test(f), entries) # mksafe(playlist("#{storage}/announcements"))
)
audio_count > 0
catch _ do
false
end
# --- Jingles / announcements (only active if they have content) ---
jingles_active = has_audio("#{storage}/jingles")
announcements_active = has_audio("#{storage}/announcements")
log("#[info] Jingles directory has audio: #{string(jingles_active)}")
log("#[info] Announcements directory has audio: #{string(announcements_active)}")
# --- Assemble the stream --------------------------------------- # --- Assemble the stream ---------------------------------------
primary = fallback(track_sensitive=false, [sched_queue, music_playlist]) primary = fallback(track_sensitive=false, [sched_queue, music_playlist])
content = # When jingles are active, uncomment this and comment out the line below:
if jingles_active then # content = random(weights=[1, 8], [jingles_src, primary])
random(weights=[1, 8], [ content = primary
mksafe(playlist("#{storage}/jingles")),
primary
])
else
primary
end
final_content = # When announcements are active, uncomment this and comment out the line below:
if announcements_active then # final_content = fallback(track_sensitive=false, [announcements_src, content])
fallback(track_sensitive=false, [ final_content = content
mksafe(playlist("#{storage}/announcements")),
content
])
else
content
end
radio = normalize(final_content) radio = normalize(final_content)