Skip to content
Snippets Groups Projects
Commit 5aa00ba7 authored by David Trattnig's avatar David Trattnig
Browse files

Refact: Make runnable with Liquidsoap 2

parent 7fbe7bf2
No related branches found
No related tags found
1 merge request!3Liquidsoap 2 migration
...@@ -25,16 +25,16 @@ fallback_inputs = ref [] ...@@ -25,16 +25,16 @@ fallback_inputs = ref []
# Create Sources # Create Sources
input_fallback_scheduled_0 = request.equeue(id="in_fallback_scheduled_0") input_fallback_scheduled_0 = request.queue(id="in_fallback_scheduled_0")
input_fallback_scheduled_1 = request.equeue(id="in_fallback_scheduled_1") input_fallback_scheduled_1 = request.queue(id="in_fallback_scheduled_1")
# Apply ReplayGain Normalization # Apply ReplayGain Normalization
input_fallback_scheduled_0 = amplify(id="in_fallback_scheduled_0", 1., override="replay_gain", input_fallback_scheduled_0) input_fallback_scheduled_0 = amplify(id="in_fallback_scheduled_0", 1., override="replay_gain", input_fallback_scheduled_0)
input_fallback_scheduled_1 = amplify(id="in_fallback_scheduled_1", 1., override="replay_gain", input_fallback_scheduled_1) input_fallback_scheduled_1 = amplify(id="in_fallback_scheduled_1", 1., override="replay_gain", input_fallback_scheduled_1)
# Add Event Handlers # Add Event Handlers
input_fallback_scheduled_0 = on_metadata(id="in_fallback_scheduled_0", on_metadata_notification, input_fallback_scheduled_0) input_fallback_scheduled_0.on_metadata(on_metadata_notification)
input_fallback_scheduled_1 = on_metadata(id="in_fallback_scheduled_1", on_metadata_notification, input_fallback_scheduled_1) input_fallback_scheduled_1.on_metadata(on_metadata_notification)
# Mixer for more control of scheduled fallbacks # Mixer for more control of scheduled fallbacks
fallback_mixer = mix(id="mixer_fallback", fallback_mixer = mix(id="mixer_fallback",
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
icecast_vorbis_metadata = false icecast_vorbis_metadata = false
inputs = ref [] inputs = ref ([])
# Load settings from ini file # Load settings from ini file
...@@ -75,9 +75,7 @@ mixer = mix(id="mixer", ...@@ -75,9 +75,7 @@ mixer = mix(id="mixer",
input_filesystem_0, input_filesystem_0,
input_filesystem_1, input_filesystem_1,
input_http_0, input_http_0,
input_http_1, input_http_1
input_https_0,
input_https_1
], ],
!inputs !inputs
) )
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
# SOURCES # # SOURCES #
##################################### #####################################
fallback_folder = ref blank() fallback_folder = ref (blank())
fallback_playlist = ref blank() fallback_playlist = ref (blank())
##################################### #####################################
...@@ -60,11 +60,12 @@ def attach_fallback_source(main_stream) ...@@ -60,11 +60,12 @@ def attach_fallback_source(main_stream)
reload_mode="seconds") reload_mode="seconds")
s = amplify(id="fallback_folder", 1., override="replay_gain", s) s = amplify(id="fallback_folder", 1., override="replay_gain", s)
s = on_metadata(id="fallback_playlist", on_metadata_notification, s) s.on_metadata(on_metadata_notification)
s = mksafe(s) s = mksafe(s)
fallback_folder := s fallback_folder := s
[ on_track(on_track_change, main_stream), !fallback_folder ] main_stream.on_track(on_track_change)
[ (main_stream:source), (!fallback_folder) ]
elsif fallback_type == "playlist" then elsif fallback_type == "playlist" then
log("Fallback Type: PLAYLIST") log("Fallback Type: PLAYLIST")
...@@ -77,14 +78,15 @@ def attach_fallback_source(main_stream) ...@@ -77,14 +78,15 @@ def attach_fallback_source(main_stream)
reload=0) reload=0)
s = amplify(id="fallback_playlist", 1., override="replay_gain", s) s = amplify(id="fallback_playlist", 1., override="replay_gain", s)
s = on_metadata(id="fallback_playlist", on_metadata_notification, s) s.on_metadata(on_metadata_notification)
s = mksafe(s) s = mksafe(s)
fallback_playlist := s fallback_playlist := s
[ on_track(on_track_change, main_stream), !fallback_playlist ] main_stream.on_track(on_track_change)
[ (main_stream:source), (!fallback_playlist:source) ]
else else
log("Fallback Type: NONE") log("Fallback Type: NONE")
[ mksafe(main_stream) ] [ (mksafe(main_stream):source) ]
end end
fallback( fallback(
......
...@@ -23,17 +23,16 @@ ...@@ -23,17 +23,16 @@
##################################### #####################################
# Create Sources # Create Sources
input_filesystem_0 = request.equeue(id="in_filesystem_0") input_filesystem_0 = request.queue(id="in_filesystem_0")
input_filesystem_1 = request.equeue(id="in_filesystem_1") input_filesystem_1 = request.queue(id="in_filesystem_1")
# Apply ReplayGain Normalization # Apply ReplayGain Normalization
input_filesystem_0 = amplify(id="in_filesystem_0", 1., override="replay_gain", input_filesystem_0) input_filesystem_0 = amplify(id="in_filesystem_0", 1., override="replay_gain", input_filesystem_0)
input_filesystem_1 = amplify(id="in_filesystem_1", 1., override="replay_gain", input_filesystem_1) input_filesystem_1 = amplify(id="in_filesystem_1", 1., override="replay_gain", input_filesystem_1)
# Add Event Handlers # Add Event Handlers
input_filesystem_0 = on_metadata(id="in_filesystem_0", on_metadata_notification, input_filesystem_0) input_filesystem_0.on_metadata(on_metadata_notification)
input_filesystem_1 = on_metadata(id="in_filesystem_1", on_metadata_notification, input_filesystem_1) input_filesystem_1.on_metadata(on_metadata_notification)
##################################### #####################################
# SERVER FUNCTIONS # # SERVER FUNCTIONS #
...@@ -46,10 +45,10 @@ server.register(namespace=source.id(input_filesystem_0), ...@@ -46,10 +45,10 @@ server.register(namespace=source.id(input_filesystem_0),
usage="clear", usage="clear",
"clear", "clear",
fun (s) -> fun (s) ->
begin begin
clear_queue(input_filesystem_0) clear_queue(input_filesystem_0)
"Clearing done." "Clearing done."
end end
) )
...@@ -59,10 +58,10 @@ server.register(namespace=source.id(input_filesystem_1), ...@@ -59,10 +58,10 @@ server.register(namespace=source.id(input_filesystem_1),
usage="clear", usage="clear",
"clear", "clear",
fun (s) -> fun (s) ->
begin begin
clear_queue(input_filesystem_1) clear_queue(input_filesystem_1)
"Clearing done." "Clearing done."
end end
) )
...@@ -72,7 +71,7 @@ server.register(namespace = source.id(input_filesystem_0), ...@@ -72,7 +71,7 @@ server.register(namespace = source.id(input_filesystem_0),
usage = "seek <duration in seconds>", usage = "seek <duration in seconds>",
"seek", "seek",
fun (t) -> fun (t) ->
begin begin
log("Seeking #{t} sec") log("Seeking #{t} sec")
t = float_of_string(default=0.,t) t = float_of_string(default=0.,t)
...@@ -87,7 +86,7 @@ server.register(namespace = source.id(input_filesystem_1), ...@@ -87,7 +86,7 @@ server.register(namespace = source.id(input_filesystem_1),
usage = "seek <duration in seconds>", usage = "seek <duration in seconds>",
"seek", "seek",
fun (t) -> fun (t) ->
begin begin
log("Seeking #{t} sec") log("Seeking #{t} sec")
t = float_of_string(default=0.,t) t = float_of_string(default=0.,t)
......
...@@ -17,31 +17,15 @@ ...@@ -17,31 +17,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Pre-population of stream input sources, as Liquidsoap needs it to initialize this input. # Pre-population of stream input sources, as Liquidsoap needs it to initialize this input.
# This is overwritten as soon as some other Stream is scheduled. # This is overwritten as soon as some other Stream is scheduled.
# #TODO Check if this is still required for Liquidsoap 2
http_starturl = "https://securestream.o94.at/live.mp3"
# http_starturl = "http://stream01.kapper.net:8001/live.mp3" # http_starturl = "http://stream01.kapper.net:8001/live.mp3"
# http_starturl = "http://stream.fro.at/fro-128.ogg" # http_starturl = "https://live.helsinki.at:8088/live160.ogg"
http_starturl = "http://trance.out.airtime.pro:8000/trance_a" # http_starturl = "https://stream.fro.at/fro-128.ogg"
# http_starturl = "http://chill.out.airtime.pro:8000/chill_a"
# http_starturl = "http://212.89.182.114:8008/frf" # http_starturl = "http://212.89.182.114:8008/frf"
https_starturl = "https://securestream.o94.at/live.mp3" input_http_0 = input.http(id="in_http_0", max_buffer=input_stream_max_buffer, timeout=input_stream_timeout, start=false, http_starturl)
# https_starturl = "https://live.helsinki.at:8088/live160.ogg" input_http_1 = input.http(id="in_http_1", max_buffer=input_stream_max_buffer, timeout=input_stream_timeout, start=false, http_starturl)
# https_starturl = "https://stream.fro.at/fro-128.ogg"
input_http_0 = input.http(id="in_http_0", buffer=input_stream_buffer, max=60.0, timeout=60.0, autostart=false, http_starturl)
input_http_1 = input.http(id="in_http_1", buffer=input_stream_buffer, max=60.0, timeout=60.0, autostart=false, http_starturl)
input_https_0 = input.https(id="in_https_0", buffer=input_stream_buffer, max=60.0, timeout=60.0, autostart=false, https_starturl)
input_https_1 = input.https(id="in_https_1", buffer=input_stream_buffer, max=60.0, timeout=60.0, autostart=false, https_starturl)
# Route input stream to an dummy output to avoid buffer-overrun messages
# output.dummy(id="SPAM_HTTP_OUTPUT_0", fallible=true, input_http_0)
# output.dummy(id="SPAM_HTTP_OUTPUT_1", fallible=true, input_http_1)
# output.dummy(id="SPAM_HTTPS_OUTPUT_0", fallible=true, input_https_0)
# output.dummy(id="SPAM_HTTPS_OUTPUT_1", fallible=true, input_https_1)
# output.dummy(blank())
\ No newline at end of file
...@@ -60,7 +60,7 @@ end ...@@ -60,7 +60,7 @@ end
##################### #####################
def stream_to_icecast(id, encoding, bitrate, host, port, pass, mount_point, url, description, genre, user, stream, streamnumber, connected, name, channels) = def stream_to_icecast(id, encoding, bitrate, host, port, pass, mount_point, url, description, genre, user, stream, streamnumber, connected, name, channels) =
source = ref stream source = ref (stream)
def on_error(msg) def on_error(msg)
connected := "false" connected := "false"
...@@ -74,7 +74,7 @@ def stream_to_icecast(id, encoding, bitrate, host, port, pass, mount_point, url, ...@@ -74,7 +74,7 @@ def stream_to_icecast(id, encoding, bitrate, host, port, pass, mount_point, url,
stereo = (int_of_string(channels) >= 2) stereo = (int_of_string(channels) >= 2)
user_ref = ref user user_ref = ref (user)
if user == "" then if user == "" then
user_ref := "source" user_ref := "source"
end end
...@@ -98,7 +98,7 @@ def stream_to_icecast(id, encoding, bitrate, host, port, pass, mount_point, url, ...@@ -98,7 +98,7 @@ def stream_to_icecast(id, encoding, bitrate, host, port, pass, mount_point, url,
# %endif # %endif
if encoding == "mp3" then if encoding == "mp3" then
log("ENABLING Mp3 to ICECAST") log("ENABLING MP3 to ICECAST")
%include "outgoing_streams/mp3.liq" %include "outgoing_streams/mp3.liq"
end end
...@@ -155,7 +155,8 @@ def get_output(source, device, name) = ...@@ -155,7 +155,8 @@ def get_output(source, device, name) =
output.pulseaudio(id=name, client="AuraEngine Line OUT", source) output.pulseaudio(id=name, client="AuraEngine Line OUT", source)
end end
else else
log("OUTPUT DUMMY") output_name = "${name}_DUMMY"
output.dummy(id=name^"_DUMMY", blank()) log("Using dummy output: " ^ output_name)
output.dummy(id=output_name, blank())
end end
end end
...@@ -91,11 +91,11 @@ s4_genre = list.assoc(default="", "stream_4_genre", ini) ...@@ -91,11 +91,11 @@ s4_genre = list.assoc(default="", "stream_4_genre", ini)
s4_name = list.assoc(default="", "stream_4_name", ini) s4_name = list.assoc(default="", "stream_4_name", ini)
s4_channels = list.assoc(default="", "stream_4_channels", ini) s4_channels = list.assoc(default="", "stream_4_channels", ini)
s0_connected = ref '' s0_connected = ref ('')
s1_connected = ref '' s1_connected = ref ('')
s2_connected = ref '' s2_connected = ref ('')
s3_connected = ref '' s3_connected = ref ('')
s4_connected = ref '' s4_connected = ref ('')
if s0_enable == true then if s0_enable == true then
# enable connection status for that stream # enable connection status for that stream
......
...@@ -29,35 +29,35 @@ engine_config_folder = list.nth(default="../config/", engine_config_folder, 0) ...@@ -29,35 +29,35 @@ engine_config_folder = list.nth(default="../config/", engine_config_folder, 0)
# ALLOW LIQUIDSOAP RUN AS ROOT # ALLOW LIQUIDSOAP RUN AS ROOT
lqs_allow_root = list.assoc(default="false", "liquidsoap_as_root", ini) lqs_allow_root = list.assoc(default="false", "liquidsoap_as_root", ini)
if lqs_allow_root == "true" then if lqs_allow_root == "true" then
set("init.allow_root", true) settings.init.allow_root.set(true)
end end
# BASICS # BASICS
set("console.colorize","always") settings.console.colorize.set("always")
#set("request.grace_time",2.) #settings.request.grace_time.set(2.)
# TELNET SETTINGS # TELNET SETTINGS
set("server.telnet", true) settings.server.telnet.set(true)
set("server.telnet.bind_addr", "0.0.0.0") settings.server.telnet.bind_addr.set("0.0.0.0")
set("server.telnet.port", 1234) settings.server.telnet.port.set(1234)
# LOGGING SETTINGS # LOGGING SETTINGS
set("log.stdout", true) settings.log.stdout.set(true)
set("log.file", true) settings.log.file.set(true)
log_level = int_of_string(list.assoc(default="3", "log_level", ini)) log_level = int_of_string(list.assoc(default="3", "log_level", ini))
set("log.level", log_level) settings.log.level.set(log_level)
log_dir = list.assoc(default="../logs", "logdir", ini) log_dir = list.assoc(default="../logs", "logdir", ini)
set("log.file.path", "#{log_dir}/engine-core.log") settings.log.file.path.set("#{log_dir}/engine-core.log")
# SOCKET SETTINGS # SOCKET SETTINGS
set("server.socket", true) settings.server.socket.set(true)
socket_dir = list.assoc(default="../socket", "socketdir", ini) socket_dir = list.assoc(default="../socket", "socketdir", ini)
set("server.socket.path", "#{socket_dir}/<script>.sock") settings.server.socket.path.set("#{socket_dir}/<script>.sock")
engine_control = list.assoc(default="localhost:1337", "engine_control_host", ini) engine_control = list.assoc(default="localhost:1337", "engine_control_host", ini)
# SOUND CARD SETTINGS # SOUND CARD SETTINGS
set("audio.converter.samplerate.converters",["ffmpeg","libsamplerate","native"]) settings.audio.converter.samplerate.converters.set(["ffmpeg","libsamplerate","native"])
set("decoder.file_decoders",["META","WAV","AIFF","FLAC","AAC","MP4","OGG","MAD"]) settings.decoder.decoders.set(["META","WAV","AIFF","FLAC","AAC","MP4","OGG","MAD"])
#print(ini) #print(ini)
a0_in = list.assoc(default="", "input_device_0", ini) a0_in = list.assoc(default="", "input_device_0", ini)
...@@ -71,7 +71,8 @@ a2_out = list.assoc(default="", "output_device_2", ini) ...@@ -71,7 +71,8 @@ a2_out = list.assoc(default="", "output_device_2", ini)
a3_out = list.assoc(default="", "output_device_3", ini) a3_out = list.assoc(default="", "output_device_3", ini)
a4_out = list.assoc(default="", "output_device_4", ini) a4_out = list.assoc(default="", "output_device_4", ini)
input_stream_buffer = float_of_string(list.assoc(default="3.0", "input_stream_buffer", ini)) input_stream_max_buffer = float_of_string(list.assoc(default="5.0", "input_stream_max_buffer", ini))
input_stream_timeout = float_of_string(list.assoc(default="10.0", "input_stream_timeout", ini))
# AUDIO AND PLAYLIST SOURCES # AUDIO AND PLAYLIST SOURCES
audio_playlist_folder = "#{engine_config_folder}/playlists" audio_playlist_folder = "#{engine_config_folder}/playlists"
...@@ -79,11 +80,9 @@ audio_playlist_folder = list.assoc(default=audio_playlist_folder, "audio_playlis ...@@ -79,11 +80,9 @@ audio_playlist_folder = list.assoc(default=audio_playlist_folder, "audio_playlis
# FALLBACK SETTINGS # FALLBACK SETTINGS
fallback_type = list.assoc(default="folder", "fallback_type", ini) fallback_type = list.assoc(default="folder", "fallback_type", ini)
fallback_station_playlist_name = "station-fallback-playlist.m3u" fallback_station_playlist_name = "station-fallback-playlist.m3u"
fallback_station_playlist_name = list.assoc(default=fallback_station_playlist_name, "fallback_music_playlist", ini) fallback_station_playlist_name = list.assoc(default=fallback_station_playlist_name, "fallback_music_playlist", ini)
fallback_station_playlist_path = "#{audio_playlist_folder}/#{fallback_station_playlist_name}" fallback_station_playlist_path = "#{audio_playlist_folder}/#{fallback_station_playlist_name}"
fallback_station_dir = list.assoc(default="/var/audio/fallback", "fallback_music_folder", ini) fallback_station_dir = list.assoc(default="/var/audio/fallback", "fallback_music_folder", ini)
fallback_station_dir_reload = int_of_string(list.assoc(default="300", "fallback_music_folder_reload", ini)) fallback_station_dir_reload = int_of_string(list.assoc(default="300", "fallback_music_folder_reload", ini))
fallback_max_blank = float_of_string(list.assoc(default="", "fallback_max_blank", ini)) fallback_max_blank = float_of_string(list.assoc(default="", "fallback_max_blank", ini))
...@@ -96,14 +95,15 @@ fade_out_time = list.assoc(default="", "fade_out_time", ini) #int_of_string(list ...@@ -96,14 +95,15 @@ fade_out_time = list.assoc(default="", "fade_out_time", ini) #int_of_string(list
# ALSA / pulse settings # ALSA / pulse settings
soundsystem = list.assoc(default="", "soundsystem", ini) soundsystem = list.assoc(default="", "soundsystem", ini)
use_alsa = soundsystem == "alsa" use_alsa = soundsystem == "alsa"
use_jack = soundsystem == "jack" use_jack = soundsystem == "jack"
version = process.read("cat ../VERSION")
print("**************************************************************************************") print("**************************************************************************************")
print(" AURA ENGINE:CORE - LIQUIDSOAP SETTINGS ") print("AURA Engine:Core v" ^ version ^ " starting ...")
print("**************************************************************************************") print("**************************************************************************************")
alsa_use_buffer = ref true alsa_use_buffer = ref (true)
if use_alsa then if use_alsa then
alsa_use_buffer := bool_of_string(list.assoc(default="true", "alsa_use_buffer", ini)) alsa_use_buffer := bool_of_string(list.assoc(default="true", "alsa_use_buffer", ini))
...@@ -118,27 +118,27 @@ if use_alsa then ...@@ -118,27 +118,27 @@ if use_alsa then
if alsa_sample_rate > 0 then if alsa_sample_rate > 0 then
print("ALSA: 'frame.audio.samplerate' to #{alsa_sample_rate}Hz") print("ALSA: 'frame.audio.samplerate' to #{alsa_sample_rate}Hz")
set("frame.audio.samplerate", alsa_sample_rate) settings.frame.audio.samplerate.set(alsa_sample_rate)
end end
if alsa_frame_duration > 0.0 then if alsa_frame_duration > 0.0 then
print("ALSA: 'frame.duration' = #{alsa_frame_duration}s") print("ALSA: 'frame.duration' = #{alsa_frame_duration}s")
set("frame.duration", alsa_frame_duration) settings.frame.duration.set(alsa_frame_duration)
end end
if alsa_frame_size > 0 then if alsa_frame_size > 0 then
print("ALSA: 'frame.audio.size' = #{alsa_frame_size}") print("ALSA: 'frame.audio.size' = #{alsa_frame_size}")
set("frame.audio.size", alsa_frame_size) settings.frame.audio.size.set(alsa_frame_size)
end end
if alsa_buffer > 0 then if alsa_buffer > 0 then
print("ALSA: 'alsa.alsa_buffer' = #{alsa_buffer}") print("ALSA: 'alsa.alsa_buffer' = #{alsa_buffer}")
set("alsa.alsa_buffer", alsa_buffer) settings.alsa.alsa_buffer.set(alsa_buffer)
end end
if alsa_buffer_length > 0 then if alsa_buffer_length > 0 then
print("ALSA: 'alsa.buffer_length' = #{alsa_buffer_length}") print("ALSA: 'alsa.buffer_length' = #{alsa_buffer_length}")
set("alsa.buffer_length", alsa_buffer_length) settings.alsa.buffer_length.set(alsa_buffer_length)
end end
if alsa_periods > 0 then if alsa_periods > 0 then
print("ALSA: 'alsa.periods' = #{alsa_periods}") print("ALSA: 'alsa.periods' = #{alsa_periods}")
set("alsa.periods", alsa_periods) settings.alsa.periods.set(alsa_periods)
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment