61 lines
2.2 KiB
XML
61 lines
2.2 KiB
XML
# -*- mode: python; encoding: utf-8 -*-
|
|
info["owner"] = "root"
|
|
info["group"] = "root"
|
|
info["mode"] = 0644
|
|
|
|
import urlparse
|
|
import urllib
|
|
import tv.radio.config as tv_config
|
|
|
|
tv_config = reload(tv_config)
|
|
|
|
out("""<![CDATA[
|
|
Fichier générer par BCfg2
|
|
Ne pas modifier à la main
|
|
Ne pas faire service icecast2 reload mais service icecast2 restart
|
|
sinon le fichier n'est pas pris en compte
|
|
(je pense que c'est un bug de la libxml utilisé par icecast)
|
|
|
|
Le fichier doit être inclus dans icecast.xml en plaçant
|
|
<!DOCTYPE icecast [
|
|
<!ENTITY radio SYSTEM "radio.xml">
|
|
]>
|
|
dans l'entête de icecast.xml puis
|
|
&radio;
|
|
là où l'on souhaite effectivement include le fichier
|
|
(quelque part dans <icecast></icecast>)
|
|
]]>""")
|
|
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:"/>
|
|
<option name="headers" value="x-auth,x-real-ip,x-forwarded-for"/>
|
|
<option name="header_prefix" value="ClientHeader."/>
|
|
</authentication>
|
|
</mount>"""
|
|
i=0
|
|
for group in tv_config.multicast.keys():
|
|
for (title, (name,dst,port,sources)) in tv_config.multicast[group].items():
|
|
p=urlparse.urlparse(sources[0])
|
|
if ':' in p.netloc:
|
|
host=p.netloc.split(':')[0]
|
|
port=p.netloc.split(':')[1]
|
|
else:
|
|
host=p.netloc
|
|
port = 80
|
|
out("""
|
|
<relay>
|
|
<server>%s</server>
|
|
<port>%s</port>
|
|
<mount>%s</mount>
|
|
<local-mount>/%s</local-mount>
|
|
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
|
|
<on-demand>1</on-demand>
|
|
</relay>""" % (host, port, p.path, name))
|
|
out(auth_template % (name,))
|
|
|