feat(playout): use liquidsoap interactive variables
This commit is contained in:
parent
394cf68b61
commit
654259824c
5 changed files with 58 additions and 58 deletions
|
@ -27,17 +27,17 @@ end
|
|||
|
||||
# A function applied to each metadata chunk
|
||||
def append_title(m) =
|
||||
log("Using stream_format #{!stream_metadata_type}")
|
||||
log("Using message format #{message_format()}")
|
||||
|
||||
if list.mem_assoc("mapped", m) then
|
||||
#protection against applying this function twice. It shouldn't be happening
|
||||
#and bug file with Liquidsoap.
|
||||
m
|
||||
else
|
||||
if !stream_metadata_type == 1 then
|
||||
[("title", "#{!show_name} - #{m['artist']} - #{m['title']}"), ("mapped", "true")]
|
||||
elsif !stream_metadata_type == 2 then
|
||||
[("title", "#{!station_name} - #{!show_name}"), ("mapped", "true")]
|
||||
if message_format() == "1" then
|
||||
[("title", "#{show_name()} - #{m['artist']} - #{m['title']}"), ("mapped", "true")]
|
||||
elsif message_format() == "2" then
|
||||
[("title", "#{station_name()} - #{show_name()}"), ("mapped", "true")]
|
||||
else
|
||||
if "#{m['artist']}" == "" then
|
||||
[("title", "#{m['title']}"), ("mapped", "true")]
|
||||
|
@ -50,10 +50,16 @@ end
|
|||
|
||||
def transition(a,b) =
|
||||
log("transition called...")
|
||||
add(normalize=false,
|
||||
[ sequence([ blank(duration=0.01),
|
||||
fade.initial(duration=!default_dj_fade, b) ]),
|
||||
fade.final(duration=!default_dj_fade, a) ])
|
||||
add(
|
||||
normalize=false,
|
||||
[
|
||||
sequence([
|
||||
blank(duration=0.01),
|
||||
fade.initial(duration=input_fade_transition(), b)
|
||||
]),
|
||||
fade.final(duration=input_fade_transition(), a)
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
# we need this function for special transition case(from default to queue)
|
||||
|
@ -63,10 +69,16 @@ def transition_default(a,b) =
|
|||
log("transition called...")
|
||||
if !just_switched then
|
||||
just_switched := false
|
||||
add(normalize=false,
|
||||
[ sequence([ blank(duration=0.01),
|
||||
fade.initial(duration=!default_dj_fade, b) ]),
|
||||
fade.final(duration=!default_dj_fade, a) ])
|
||||
add(
|
||||
normalize=false,
|
||||
[
|
||||
sequence([
|
||||
blank(duration=0.01),
|
||||
fade.initial(duration=input_fade_transition(), b)
|
||||
]),
|
||||
fade.final(duration=input_fade_transition(), a)
|
||||
]
|
||||
)
|
||||
else
|
||||
just_switched := false
|
||||
b
|
||||
|
@ -90,12 +102,12 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
|||
source = ref s
|
||||
def on_error(msg)
|
||||
connected := "false"
|
||||
gateway("stream '#{stream}' '#{!time}' --error='#{msg}'")
|
||||
gateway("stream '#{stream}' '#{boot_timestamp()}' --error='#{msg}'")
|
||||
5.
|
||||
end
|
||||
def on_connect()
|
||||
connected := "true"
|
||||
gateway("stream '#{stream}' '#{!time}'")
|
||||
gateway("stream '#{stream}' '#{boot_timestamp()}'")
|
||||
end
|
||||
|
||||
stereo = (channels == "stereo")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
time = ref string_of(gettimeofday())
|
||||
boot_timestamp = interactive.string("boot_timestamp", string_of(gettimeofday()))
|
||||
|
||||
#Dynamic source list
|
||||
#dyn_sources = ref []
|
||||
|
@ -6,7 +6,7 @@ webstream_enabled = ref false
|
|||
|
||||
current_dyn_id = ref '-1'
|
||||
|
||||
show_name = ref ''
|
||||
show_name = interactive.string("show_name", "")
|
||||
|
||||
dynamic_metadata_callback = ref fun (~new_track=false, s) -> begin () end
|
||||
|
||||
|
@ -76,27 +76,9 @@ stream_queue = map_metadata(update=false, append_title, stream_queue)
|
|||
|
||||
ignore(output.dummy(stream_queue, fallible=true))
|
||||
|
||||
server.register(namespace="vars",
|
||||
"stream_metadata_type",
|
||||
fun (s) -> begin log("vars.stream_metadata_type") stream_metadata_type := int_of_string(s) s end)
|
||||
server.register(namespace="vars",
|
||||
"show_name",
|
||||
fun (s) -> begin log("vars.show_name") show_name := s s end)
|
||||
server.register(namespace="vars",
|
||||
"station_name",
|
||||
fun (s) -> begin log("vars.station_name") station_name := s s end)
|
||||
server.register(namespace="vars",
|
||||
"off_air_meta",
|
||||
fun (s) -> begin log("vars.off_air_meta") off_air_meta := s s end)
|
||||
server.register(namespace="vars",
|
||||
"bootup_time",
|
||||
fun (s) -> begin log("vars.bootup_time") time := s s end)
|
||||
server.register(namespace="streams",
|
||||
"connection_status",
|
||||
fun (s) -> begin log("streams.connection_status") "1:#{!s1_connected},2:#{!s2_connected},3:#{!s3_connected},4:#{!s4_connected}" end)
|
||||
server.register(namespace="vars",
|
||||
"default_dj_fade",
|
||||
fun (s) -> begin log("vars.default_dj_fade") default_dj_fade := float_of_string(s) s end)
|
||||
|
||||
server.register(namespace="dynamic_source",
|
||||
description="Enable webstream output",
|
||||
|
@ -141,13 +123,12 @@ server.register(namespace="dynamic_source",
|
|||
# fun (s) -> begin log("dynamic_source.read_stop") destroy_dynamic_source_all() end)
|
||||
|
||||
default = amplify(id="silence_src", 0.00001, noise())
|
||||
if !off_air_meta == "" then
|
||||
off_air_meta := "LibreTime - offline"
|
||||
|
||||
def map_message_offline(m) =
|
||||
[("title", message_offline())]
|
||||
end
|
||||
def map_off_air_meta(m) =
|
||||
[("title", !off_air_meta)]
|
||||
end
|
||||
default = map_metadata(map_off_air_meta, default)
|
||||
|
||||
default = map_metadata(map_message_offline, default)
|
||||
ignore(output.dummy(default, fallible=true))
|
||||
|
||||
master_dj_enabled = ref false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue