another refactor of the switches in LS
This commit is contained in:
parent
7e19eba7e1
commit
0f7063e8a6
|
@ -195,103 +195,56 @@ def check_dj_client(user,password) =
|
|||
hd == "True"
|
||||
end
|
||||
|
||||
def append_dj_inputs(master_harbor_input_port,
|
||||
master_harbor_input_mount_point,
|
||||
dj_harbor_input_port,
|
||||
dj_harbor_input_mount_point,
|
||||
s) =
|
||||
if master_harbor_input_port != 0
|
||||
and master_harbor_input_mount_point != ""
|
||||
and dj_harbor_input_port != 0
|
||||
and dj_harbor_input_mount_point != "" then
|
||||
|
||||
master_dj = mksafe(
|
||||
audio_to_stereo(
|
||||
input.harbor(id="master_harbor",
|
||||
master_harbor_input_mount_point,
|
||||
port=master_harbor_input_port,
|
||||
auth=check_master_dj_client,
|
||||
max=40.,
|
||||
on_connect=master_dj_connect,
|
||||
on_disconnect=master_dj_disconnect)))
|
||||
|
||||
dj_live = mksafe(
|
||||
audio_to_stereo(
|
||||
input.harbor(id="live_dj_harbor",
|
||||
dj_harbor_input_mount_point,
|
||||
port=dj_harbor_input_port,
|
||||
auth=check_dj_client,
|
||||
max=40.,
|
||||
on_connect=live_dj_connect,
|
||||
on_disconnect=live_dj_disconnect)))
|
||||
|
||||
ignore(output.dummy(master_dj, fallible=true))
|
||||
ignore(output.dummy(dj_live, fallible=true))
|
||||
|
||||
([transition, transition, transition],
|
||||
[
|
||||
({!master_dj_enabled},master_dj),
|
||||
({!live_dj_enabled},dj_live),
|
||||
({true}, s),
|
||||
])
|
||||
|
||||
elsif master_harbor_input_port != 0 and master_harbor_input_mount_point != "" then
|
||||
master_dj = mksafe(
|
||||
audio_to_stereo(
|
||||
input.harbor(id="master_harbor",
|
||||
master_harbor_input_mount_point,
|
||||
port=master_harbor_input_port,
|
||||
auth=check_master_dj_client,
|
||||
max=40.,
|
||||
on_connect=master_dj_connect,
|
||||
on_disconnect=master_dj_disconnect)))
|
||||
|
||||
ignore(output.dummy(master_dj, fallible=true))
|
||||
|
||||
([transition, transition],
|
||||
[
|
||||
({!master_dj_enabled},master_dj),
|
||||
({true}, s),
|
||||
])
|
||||
|
||||
elsif dj_harbor_input_port != 0 and dj_harbor_input_mount_point != "" then
|
||||
dj_live = mksafe(
|
||||
audio_to_stereo(
|
||||
input.harbor(id="live_dj_harbor",
|
||||
dj_harbor_input_mount_point,
|
||||
port=dj_harbor_input_port,
|
||||
auth=check_dj_client,
|
||||
max=40.,
|
||||
on_connect=live_dj_connect,
|
||||
on_disconnect=live_dj_disconnect)))
|
||||
|
||||
ignore(output.dummy(dj_live, fallible=true))
|
||||
|
||||
([transition, transition],
|
||||
[
|
||||
({!live_dj_enabled},dj_live),
|
||||
({true}, s),
|
||||
])
|
||||
else
|
||||
([transition], [
|
||||
({true}, s),
|
||||
])
|
||||
end
|
||||
end
|
||||
|
||||
s = switch(id="default_switch",
|
||||
s = switch(id="schedule_noise_switch",
|
||||
track_sensitive=false,
|
||||
transitions=[transition_default, transition],
|
||||
[({!scheduled_play_enabled}, stream_queue), ({true}, default)])
|
||||
[({!scheduled_play_enabled}, stream_queue), ({true}, default)]
|
||||
)
|
||||
|
||||
pair = append_dj_inputs(master_live_stream_port, master_live_stream_mp,
|
||||
dj_live_stream_port, dj_live_stream_mp, s)
|
||||
s = if dj_live_stream_port != 0 and dj_live_stream_mp != "" then
|
||||
dj_live = mksafe(
|
||||
audio_to_stereo(
|
||||
input.harbor(id="live_dj_harbor",
|
||||
dj_live_stream_mp,
|
||||
port=dj_live_stream_port,
|
||||
auth=check_dj_client,
|
||||
max=40.,
|
||||
on_connect=live_dj_connect,
|
||||
on_disconnect=live_dj_disconnect)))
|
||||
|
||||
s = switch(id="master_switch",
|
||||
ignore(output.dummy(dj_live, fallible=true))
|
||||
|
||||
switch(id="show_schedule_noise_switch",
|
||||
track_sensitive=false,
|
||||
transitions=fst(pair),
|
||||
snd(pair)
|
||||
)
|
||||
transitions=[transition, transition],
|
||||
[({!live_dj_enabled}, dj_live), ({true}, s)]
|
||||
)
|
||||
else
|
||||
s
|
||||
end
|
||||
|
||||
s = if master_live_stream_port != 0 and master_live_stream_mp != "" then
|
||||
master_dj = mksafe(
|
||||
audio_to_stereo(
|
||||
input.harbor(id="master_harbor",
|
||||
master_live_stream_mp,
|
||||
port=master_live_stream_port,
|
||||
auth=check_master_dj_client,
|
||||
max=40.,
|
||||
on_connect=master_dj_connect,
|
||||
on_disconnect=master_dj_disconnect)))
|
||||
|
||||
ignore(output.dummy(master_dj, fallible=true))
|
||||
|
||||
switch(id="master_show_schedule_noise_switch",
|
||||
track_sensitive=false,
|
||||
transitions=[transition, transition],
|
||||
[({!master_dj_enabled}, master_dj), ({true}, s)]
|
||||
)
|
||||
else
|
||||
s
|
||||
end
|
||||
|
||||
|
||||
# Attach a skip command to the source s:
|
||||
add_skip_command(s)
|
||||
|
|
Loading…
Reference in New Issue