[icecast.py] Mis dans bcfg2
This commit is contained in:
parent
0975796083
commit
9df9523476
1 changed files with 0 additions and 39 deletions
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf8 -*-
|
||||
# Utilisé pour générer le contenu du fichier /etc/icecast2/radio.xml
|
||||
|
||||
import urlparse
|
||||
import urllib
|
||||
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
|
||||
for group in multicast.keys():
|
||||
for (title, (name,dst,port,sources)) in 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
|
||||
print """
|
||||
<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)
|
||||
print auth_template % name
|
Loading…
Add table
Add a link
Reference in a new issue