add legacy script for liquidsoap 1.1.1 compatibility
This commit is contained in:
parent
1c2906f5ab
commit
0931ba842a
6 changed files with 890 additions and 25 deletions
|
@ -41,7 +41,7 @@ source_id = ref 0
|
|||
|
||||
def check_version(~version=liquidsoap.version, major, minor) =
|
||||
v = list.map(int_of_string, string.split(separator="\.", version))
|
||||
list.nth(v,0) > major or list.nth(v,0) == major and list.nth(v,1) >= minor
|
||||
list.nth(v,0,default=0) > major or list.nth(v,0,default=0) == major and list.nth(v,1,default=0) >= minor
|
||||
end
|
||||
|
||||
# cue cut fix for liquidsoap <1.2.2
|
||||
|
@ -235,26 +235,40 @@ def master_dj_disconnect() =
|
|||
update_source_status("master_dj", false)
|
||||
end
|
||||
|
||||
#auth function for live stream
|
||||
def check_master_dj_client(user,password) =
|
||||
log("master connected")
|
||||
#get the output of the php script
|
||||
ret = get_process_lines("python #{auth_path} --master #{user} #{password}")
|
||||
#ret has now the value of the live client (dj1,dj2, or djx), or "ERROR"/"unknown" ...
|
||||
ret = list.hd(ret)
|
||||
# Auth function for live stream
|
||||
# @Category LiveStream
|
||||
# @param user Username to check against LibreTime API
|
||||
# @param password Password to check against LibreTime API
|
||||
# @param ~type Type of password to check, "dj" or "master, default: "master"
|
||||
def check_auth(user="", password="", ~type="master") =
|
||||
log("#{type} user #{user} connected",label="#{type}_source")
|
||||
|
||||
#return true to let the client transmit data, or false to tell harbor to decline
|
||||
ret == "True"
|
||||
# Check auth based on return value from auth script
|
||||
ret = snd(snd(run_process("python #{auth_path} --#{type} #{user} #{password}"))) == "0"
|
||||
|
||||
if ret then
|
||||
log("#{type} user #{user} authenticated",label="#{type}_source")
|
||||
else
|
||||
log("#{type} user #{user} auth failed",label="#{type}_source",level=2)
|
||||
end
|
||||
|
||||
ret
|
||||
end
|
||||
|
||||
def check_dj_client(user,password) =
|
||||
log("live dj connected")
|
||||
#get the output of the php script
|
||||
ret = get_process_lines("python #{auth_path} --dj #{user} #{password}")
|
||||
#ret has now the value of the live client (dj1,dj2, or djx), or "ERROR"/"unknown" ...
|
||||
hd = list.hd(ret)
|
||||
log("Live DJ authenticated: #{hd}")
|
||||
hd == "True"
|
||||
# Check master source auth
|
||||
# @Category LiveStream
|
||||
# @param user Username to check against LibreTime API
|
||||
# @param password Password to check against LibreTime API
|
||||
def check_master_dj_client(user, password) =
|
||||
check_auth(user, password)
|
||||
end
|
||||
|
||||
# Check dj/show source auth
|
||||
# @Category LiveStream
|
||||
# @param user Username to check against LibreTime API
|
||||
# @param password Password to check against LibreTime API
|
||||
def check_dj_client(user, password) =
|
||||
check_auth(user, password, type="dj")
|
||||
end
|
||||
|
||||
s = switch(id="schedule_noise_switch",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue