[tv/radio] Mise en place d'une authentifications pour la radio hors zone crans

This commit is contained in:
Valentin Samir 2014-12-07 16:17:33 +01:00
parent 0e1178bd1a
commit ef6ea1e386

View file

@ -1,9 +1,22 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
# Utilisé pour générer le contenu du fichier /etc/icecast2/radio.xml
import urlparse import urlparse
import urllib import urllib
from config import * from config import *
auth_template = """<mount>
<mount-name>/%s</mount-name>
<authentication type="url">
<option name="listener_add" value="https://intranet2.crans.org/tv/auth"/>
<option name="listener_remove" value="https://intranet2.crans.org/tv/auth"/>
<option name="mount_add" value="https://intranet2.crans.org/tv/auth"/>
<option name="mount_remove" value="https://intranet2.crans.org/tv/auth"/>
<option name="auth_header" value="icecast-auth-user: 1"/>
<option name="timelimit_header" value="icecast-auth-timelimit:"/>
</authentication>
</mount>"""
i=0 i=0
for group in multicast.keys(): for group in multicast.keys():
for (title, (name,dst,port,sources)) in multicast[group].items(): for (title, (name,dst,port,sources)) in multicast[group].items():
@ -23,3 +36,4 @@ for group in multicast.keys():
<relay-shoutcast-metadata>1</relay-shoutcast-metadata> <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
<on-demand>1</on-demand> <on-demand>1</on-demand>
</relay>""" % (host, port, p.path, name) </relay>""" % (host, port, p.path, name)
print auth_template % name