From a064cbda2086b79b6cc04111cb308a6b2d770aa6 Mon Sep 17 00:00:00 2001 From: heqnx Date: Sun, 6 Jul 2025 14:57:39 +0300 Subject: replaced ices2 which only supports vorbis, with liquidsoap + creation of title metadata; reorganized templates --- templates/etc/icecast2/icecast.xml.j2 | 66 +++++++++++++++++++++++++++++ templates/etc/icecast2/ices-playlist.xml.j2 | 44 +++++++++++++++++++ templates/etc/icecast2/mp3-to-ogg.sh.j2 | 36 ++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 templates/etc/icecast2/icecast.xml.j2 create mode 100644 templates/etc/icecast2/ices-playlist.xml.j2 create mode 100644 templates/etc/icecast2/mp3-to-ogg.sh.j2 (limited to 'templates/etc/icecast2') diff --git a/templates/etc/icecast2/icecast.xml.j2 b/templates/etc/icecast2/icecast.xml.j2 new file mode 100644 index 0000000..ef6e539 --- /dev/null +++ b/templates/etc/icecast2/icecast.xml.j2 @@ -0,0 +1,66 @@ + + Earth + {{ email }} + + + 1000 + 2 + 524288 + 30 + 15 + 10 + 1 + 65535 + + + + {{ random_password }} + disabled + admin + {{ random_password }} + + + localhost + "" + + + 8000 + 127.0.0.1 + + + +
+ + + + /stream + 1000 + 1 + 1 + + + 1 + + + /usr/share/icecast2 + /var/log/icecast2 + /usr/share/icecast2/web + /usr/share/icecast2/admin + + + + + access.log + error.log + 2 + 10000 + + + + 1 + + icecast2 + icecast + + + diff --git a/templates/etc/icecast2/ices-playlist.xml.j2 b/templates/etc/icecast2/ices-playlist.xml.j2 new file mode 100644 index 0000000..89fc4c9 --- /dev/null +++ b/templates/etc/icecast2/ices-playlist.xml.j2 @@ -0,0 +1,44 @@ + + + 1 + /var/log/ices + ices.log + 4 + 1 + + + + + + Example stream name + Example genre + A short description of your stream + + + + playlist + basic + playlist.txt + 1 + 0 + 0 + + + + localhost + 8000 + {{ random_password }} + /stream + 0 + 60 + 10 + 80 + + + + + diff --git a/templates/etc/icecast2/mp3-to-ogg.sh.j2 b/templates/etc/icecast2/mp3-to-ogg.sh.j2 new file mode 100644 index 0000000..f475d36 --- /dev/null +++ b/templates/etc/icecast2/mp3-to-ogg.sh.j2 @@ -0,0 +1,36 @@ +#!/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} with ${title}" + + if ffmpeg -loglevel error -y -i "${mp3file}" -acodec libvorbis -q:a 5 -metadata title="${title}" "${oggfile}"; then + printf "%s\n" "[inf] conversion successful, removing ${mp3file}" + rm -f "${mp3file}" + else + printf "%s\n" "[err] conversion failed for ${mp3file}" + fi +done + +for oggfile in "${DIR}"/*.ogg; do + title="$(basename "${oggfile}" .ogg)" + vorbiscomment -w -t "TITLE=${title}" "${oggfile}" +done + +ls "${DIR}"/*.ogg > "${DIR}/playlist.txt" +printf "%s\n" "[inf] playlist generated at ${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 -- cgit v1.2.3