feat(playout): migrate notify cli to click (#1519)
Fixes #1502 - replace notify option parser with click - refactor call from liquidsoap to playout-notify BREAKING CHANGE: the libretime-layout-notify log file in '/var/log/airtime/pypo-liquidsoap/notify.log' was removed and merged into the existing '/var/log/libretime/liquidsoap.log' log file.
This commit is contained in:
parent
fe0b2c4a7a
commit
5364911922
8 changed files with 130 additions and 230 deletions
|
@ -1,7 +1,13 @@
|
|||
def notify(m)
|
||||
command = "timeout --signal=KILL 45 libretime-playout-notify --media-id=#{m['schedule_table_id']} &"
|
||||
def gateway(args)
|
||||
prefix = "timeout --signal=KILL 45"
|
||||
command = "libretime-playout-notify #{args}"
|
||||
suffix = "&"
|
||||
log(command)
|
||||
system(command)
|
||||
system("#{prefix} #{command} #{suffix}")
|
||||
end
|
||||
|
||||
def notify(m)
|
||||
gateway("media '#{m['schedule_table_id']}'")
|
||||
end
|
||||
|
||||
def notify_queue(m)
|
||||
|
@ -11,15 +17,13 @@ def notify_queue(m)
|
|||
end
|
||||
|
||||
def notify_stream(m)
|
||||
json_str = string.replace(pattern="\n",(fun (s) -> ""), json_of(m))
|
||||
#if a string has a single apostrophe in it, let's comment it out by ending the string before right before it
|
||||
#escaping the apostrophe, and then starting a new string right after it. This is why we use 3 apostrophes.
|
||||
json_str = string.replace(pattern="'",(fun (s) -> "'\''"), json_str)
|
||||
command = "timeout --signal=KILL 45 libretime-playout-notify --webstream='#{json_str}' --media-id=#{!current_dyn_id} &"
|
||||
|
||||
if !current_dyn_id != "-1" then
|
||||
log(command)
|
||||
system(command)
|
||||
json_str = string.replace(pattern="\n",(fun (s) -> ""), json_of(m))
|
||||
#if a string has a single apostrophe in it, let's comment it out by ending the string before right before it
|
||||
#escaping the apostrophe, and then starting a new string right after it. This is why we use 3 apostrophes.
|
||||
json_str = string.replace(pattern="'",(fun (s) -> "'\''"), json_str)
|
||||
|
||||
gateway("webstream '#{!current_dyn_id}' '#{json_str}'")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -97,16 +101,12 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
|||
source = ref s
|
||||
def on_error(msg)
|
||||
connected := "false"
|
||||
command = "timeout --signal=KILL 45 libretime-playout-notify --error='#{msg}' --stream-id=#{stream} --time=#{!time} &"
|
||||
system(command)
|
||||
log(command)
|
||||
gateway("stream '#{stream}' '#{!time}' --error='#{msg}'")
|
||||
5.
|
||||
end
|
||||
def on_connect()
|
||||
connected := "true"
|
||||
command = "timeout --signal=KILL 45 libretime-playout-notify --connect --stream-id=#{stream} --time=#{!time} &"
|
||||
system(command)
|
||||
log(command)
|
||||
gateway("stream '#{stream}' '#{!time}'")
|
||||
end
|
||||
|
||||
stereo = (channels == "stereo")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue