Describe the problem
This post is here to eventually help others solve similar issues, or maybe get better solutions from the community ![]()
Our problems were :
- impossible to use the hardware audio output with pulseaudio
- necessity to have a “default” auto-dj when there is no scheduled shows
To reproduce
Setting enabled: true in this section of the config.yml file should enable the audio output of the system but it does not work with pulseaudio.
system:
- # Whether the output is enabled.
# > default is false
enabled: true
# System output kind.
# > must be one of (alsa, ao, oss, portaudio, pulseaudio)
# > default is alsa
kind: pulseaudio
Expected behavior
System audio output should work.
Relevant log output or error messages
The liquidsoap logs show that liquidsoap loops on an error.
LibreTime version
LibreTime version: 4.5.0
Installation method and OS / Environment
Installed with the install script on an Ubuntu 20.04 machine.
Solutions
Enabling system audio output
We added the two following lines in the libretime-liquidsoap.service file :
Environment="XDG_RUNTIME_DIR=/run/user/1000"
Environment="PULSE_RUNTIME_PATH=/run/user/1000/pulse/"
Adding a default auto-dj
We added the following lines in /opt/libretime/lib/python3.8/site-packages/libretime_playout/liquidsoap/1.4/ls_script.liq (sorry comments are in french) :
################ DEBUT AJOUT POUR L'AUTODJ
########################### INIT PLAYLIST ##################################
ignore(run_process("python3 /home/radio-dragon/autoDJ/scripts/create_playlist.py"))
########################### REFRESH PLAYLIST EVERY NIGHT ##################################
exec_at(freq=1800., pred={ 23h00-23h50 },
fun() -> ignore(run_process("python3 /home/radio-dragon/autoDJ/scripts/create_playlist.py"))
)
########################### TRANSITIONS ##################################
# a 3-seconds crossfade operator that skips the cutted track.
# Skipping avoids getting back in the middle of a music track after a live show,
# but it requires a weird implementation. See https://github.com/savonet/liquidsoap/issues/1548
def crossfade_3s(a,b)
faded = add(normalize=false, [
fade.in(duration=3., type="exp", b),
amplify(mkfade(duration=3., start=1., stop=0., type="exp", a) ,a)
])
add_timeout(10., { source.skip(a) ; -1.})
faded
end
# Transition entre émission et playlist
def back_to_playlist(live, playlist) =
# Cancel current track. This will also set the playlist
# to play a new track.
source.skip(playlist)
sequence([live, playlist])
end
# Transition vers libretime
def to_libretime(playlist, live) =
sequence([playlist,live])
end
########################### AUTODJ ##################################
autodj = playlist(reload_mode="watch", "/home/radio-dragon/autoDJ/playlist_autodj.txt",mode="normal")
# 780 = au moins 13 minutes de délai entre les jingles
# "delay" compte en secondes et c'est forcément un flottant d'ou le point obligatoire
jingles = delay(780., id="jingles",
playlist.safe("/home/radio-dragon/Musique/JINGLES-BA-FOCUS/Jingles en COURS", mode="random", reload_mode="watch")
)
# à la fin de chaque track, va piocher un jingle s'il est dispo (après lecture, il n'est pas dispo)
autodj_avec_jingle = fallback([jingles, autodj], id="autodj_avec_jingle")
########################### PLAYLIST SECOURS ##################################
secours = mksafe(playlist("/home/radio-dragon/Musique/playlist_secours",reload_mode="watch"))
########################### COMBINING SOURCES ##################################
default = fallback(track_sensitive=false,transitions=[back_to_playlist,to_libretime],
[autodj_avec_jingle,secours], id="default")
######################################################## FIN AJOUT POUR L'AUTODJ
So there are only 2 files to watch for and backup before upgrading to a new Libretime version.
Comments welcome !