CC-3224: "On-the-fly" stream rebroadcasting
- web interface - auth script for liquidsoap - DB changes
This commit is contained in:
parent
701ed82f40
commit
48bb19d758
26 changed files with 650 additions and 101 deletions
19
python_apps/pypo/liquidsoap_scripts/liquidsoap_auth.py
Normal file
19
python_apps/pypo/liquidsoap_scripts/liquidsoap_auth.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from api_clients import *
|
||||
from configobj import ConfigObj
|
||||
import sys
|
||||
import json
|
||||
|
||||
try:
|
||||
config = ConfigObj('/etc/airtime/pypo.cfg')
|
||||
|
||||
except Exception, e:
|
||||
print 'error: ', e
|
||||
sys.exit()
|
||||
|
||||
api_clients = api_client.api_client_factory(config)
|
||||
|
||||
username = sys.argv[1]
|
||||
password = sys.argv[2]
|
||||
response = api_clients.check_live_stream_auth(username, password)
|
||||
|
||||
print response['msg']
|
|
@ -41,15 +41,20 @@ default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default)
|
|||
#live stream setup
|
||||
set("harbor.bind_addr", "0.0.0.0")
|
||||
#auth function for live stream
|
||||
def auth(user, password) =
|
||||
if user == 'james' and password == 'james' then
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
def check_client(user,password) =
|
||||
#get the output of the php script
|
||||
ret = get_process_lines("python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_auth.py #{user} #{password}")
|
||||
#ret has now the value of the live client (dj1,dj2, or djx), or "ERROR"/"unknown" ...
|
||||
ret = list.hd(ret)
|
||||
#return true to let the client transmit data, or false to tell harbor to decline
|
||||
if (ret == "True") then
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
live = input.harbor("test", port=8080, auth=auth)
|
||||
live = input.harbor("test", port=8080, auth=check_client)
|
||||
|
||||
s = fallback(track_sensitive=false, [live, queue, default])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue