-pypo now working
This commit is contained in:
parent
70f7cb6edc
commit
3d4d3afc5d
5 changed files with 70 additions and 14 deletions
|
@ -1,7 +1,8 @@
|
|||
%include "library/pervasives.liq"
|
||||
%include "ls_config.liq"
|
||||
|
||||
set("log.file.path",log_file)
|
||||
set("log.file.path", log_file)
|
||||
set("log.stdout", true)
|
||||
set("server.telnet", true)
|
||||
|
||||
active_queue = ref 0
|
||||
|
@ -16,8 +17,7 @@ pypo_data = ref '0'
|
|||
|
||||
# push function, enqueues file in inactive queue (does not start automatically)
|
||||
def scheduler_push(s)
|
||||
print('s: #{s}')
|
||||
server.execute("scheduler_q#{!active_queue}.push #{s}")
|
||||
ignore(server.execute("scheduler_q#{!active_queue}.push #{s}"))
|
||||
print('push to #{!active_queue} - #{s}')
|
||||
"Done"
|
||||
end
|
||||
|
@ -34,22 +34,29 @@ def scheduler_flip()
|
|||
|
||||
# flip variables
|
||||
active_queue := 1-!active_queue
|
||||
print('switch to active queue: #{!active_queue}')
|
||||
"Done"
|
||||
end
|
||||
|
||||
def notify(m)
|
||||
system("./notify.sh --data='#{!pypo_data}' --media-id=#{m['media_id']}")
|
||||
#print("./notify.sh --data='#{!pypo_data}' --media-id=#{m['media_id']}")
|
||||
print("./notify.sh --data='#{!pypo_data}' --media-id=#{m['media_id']}")
|
||||
end
|
||||
|
||||
# register for telnet access
|
||||
server.register(namespace="scheduler","push", scheduler_push)
|
||||
server.register(namespace="scheduler","flip", fun (s) -> begin scheduler_flip() end)
|
||||
server.register(namespace="vars", "pypo_data", fun (s) -> begin pypo_data := s "Done" end)
|
||||
|
||||
default = single("/opt/pypo/files/basic/silence.mp3")
|
||||
radio = fallback([ switch(track_sensitive=false, [(fun () -> !active_queue==1, scheduler_q0), (fun () -> !active_queue==0, scheduler_q1)]), default])
|
||||
radio = fallback(track_sensitive=false, [switch(track_sensitive=false, [(fun () -> !active_queue==1, scheduler_q0), (fun () -> !active_queue==0, scheduler_q1)]), default])
|
||||
|
||||
radio = on_metadata(notify, radio)
|
||||
#radio = on_metadata(notify, radio)
|
||||
|
||||
out(radio)
|
||||
#out(radio)
|
||||
clock(id="clock_icecast",
|
||||
output.icecast(%mp3,
|
||||
host = icecast_host, port = icecast_port,
|
||||
password = icecast_pass, mount = mount_scheduler,
|
||||
fallible = true,
|
||||
restart = true,
|
||||
restart_delay = 5,
|
||||
buffer(radio)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue