summaryrefslogtreecommitdiff
path: root/templates/icecast2
diff options
context:
space:
mode:
Diffstat (limited to 'templates/icecast2')
-rw-r--r--templates/icecast2/icecast.xml.j265
-rw-r--r--templates/icecast2/ices-playlist.xml.j244
-rw-r--r--templates/icecast2/mp3-to-ogg.sh.j232
3 files changed, 141 insertions, 0 deletions
diff --git a/templates/icecast2/icecast.xml.j2 b/templates/icecast2/icecast.xml.j2
new file mode 100644
index 0000000..4c665b7
--- /dev/null
+++ b/templates/icecast2/icecast.xml.j2
@@ -0,0 +1,65 @@
+<icecast>
+ <location>Earth</location>
+ <admin>{{ email }}</admin>
+
+ <limits>
+ <clients>1000</clients>
+ <sources>2</sources>
+ <queue-size>524288</queue-size>
+ <client-timeout>30</client-timeout>
+ <header-timeout>15</header-timeout>
+ <source-timeout>10</source-timeout>
+ <burst-on-connect>1</burst-on-connect>
+ <burst-size>65535</burst-size>
+ </limits>
+
+ <authentication>
+ <source-password></source-password>
+ <relay-password>disabled</relay-password>
+ <admin-user>admin</admin-user>
+ <admin-password>password</admin-password>
+ </authentication>
+
+ <hostname>localhost</hostname>
+
+ <listen-socket>
+ <port>8000</port>
+ <bind-address>127.0.0.1</bind-address>
+ </listen-socket>
+
+ <http-headers>
+ <header name="Access-Control-Allow-Origin" value="*" />
+ </http-headers>
+
+ <mount>
+ <mount-name>/stream</mount-name>
+ <max-listeners>1000</max-listeners>
+ <public>1</public>
+ <no-yp>1</no-yp>
+ </mount>
+
+ <fileserve>1</fileserve>
+
+ <paths>
+ <basedir>/usr/share/icecast2</basedir>
+ <logdir>/var/log/icecast2</logdir>
+ <webroot>/usr/share/icecast2/web</webroot>
+ <adminroot>/usr/share/icecast2/admin</adminroot>
+ <alias source="/" destination="/status.xsl"/>
+ </paths>
+
+ <logging>
+ <accesslog>access.log</accesslog>
+ <errorlog>error.log</errorlog>
+ <loglevel>2</loglevel>
+ <logsize>10000</logsize>
+ </logging>
+
+ <security>
+ <chroot>1</chroot>
+ <changeowner>
+ <user>icecast2</user>
+ <group>icecast</group>
+ </changeowner>
+ </security>
+</icecast>
diff --git a/templates/icecast2/ices-playlist.xml.j2 b/templates/icecast2/ices-playlist.xml.j2
new file mode 100644
index 0000000..ae9a6be
--- /dev/null
+++ b/templates/icecast2/ices-playlist.xml.j2
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<ices>
+ <background>1</background>
+ <logpath>/var/log/ices</logpath>
+ <logfile>ices.log</logfile>
+ <loglevel>4</loglevel>
+ <consolelog>1</consolelog>
+
+ <!-- <pidfile>/home/ices/ices.pid</pidfile> -->
+
+ <stream>
+ <metadata>
+ <name>Example stream name</name>
+ <genre>Example genre</genre>
+ <description>A short description of your stream</description>
+ </metadata>
+
+ <input>
+ <module>playlist</module>
+ <param name="type">basic</param>
+ <param name="file">playlist.txt</param>
+ <param name="random">1</param>
+ <param name="restart-after-reread">0</param>
+ <param name="once">0</param>
+ </input>
+
+ <instance>
+ <hostname>localhost</hostname>
+ <port>8000</port>
+ <password>password</password>
+ <mount>/stream</mount>
+ <yp>0</yp>
+ <reconnectdelay>60</reconnectdelay>
+ <reconnectattempts>10</reconnectattempts>
+ <maxqueuelength>80</maxqueuelength>
+
+ <!--<encode>
+ <nominal-bitrate>64000</nominal-bitrate>
+ <samplerate>44100</samplerate>
+ <channels>2</channels>
+ </encode>-->
+ </instance>
+ </stream>
+</ices>
diff --git a/templates/icecast2/mp3-to-ogg.sh.j2 b/templates/icecast2/mp3-to-ogg.sh.j2
new file mode 100644
index 0000000..b37f5af
--- /dev/null
+++ b/templates/icecast2/mp3-to-ogg.sh.j2
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+if ! command -v ffmpeg &>/dev/null; then
+ printf "%s\n" "[err] ffmpeg not found"
+ exit 1
+fi
+
+DIR="{{ radio_music_dir }}"
+
+shopt -s nullglob
+for mp3file in "${DIR}"/*.mp3; do
+ oggfile="${mp3file%.mp3}.ogg"
+
+ printf "%s\n" "[inf] converting ${mp3file} to ${oggfile}"
+
+ if ffmpeg -loglevel error -y -i "${mp3file}" -acodec libvorbis -q:a 5 "${oggfile}"; then
+ printf "%s\n" "[inf] conversion successful, removing ${mp3file}"
+ rm -f "${mp3file}"
+ else
+ printf "%s\n" "[err] conversion failed for ${mp3file}"
+ fi
+done
+
+ls "${DIR}"/*.ogg > "${DIR}/playlist.txt"
+
+if id -u icecast2 >/dev/null 2>&1 && getent group icecast >/dev/null 2>&1; then
+ chown -R icecast2:icecast "$DIR"
+ printf "%s\n" "[inf] chowned ${DIR} with icecast2:icecast"
+else
+ printf "%s\n" "[err] user or group icecast2:icecast does not exist, skipping chown"
+fi
+