secubox-openwrt/package/secubox/secubox-app-webradio/files/etc/init.d/webradio
CyberMind-FR 6db547f7f8 feat: Add WebRadio, TURN server, and Lyrion streaming integration
New packages:
- luci-app-webradio: Web radio management with Lyrion bridge tab
- luci-app-turn: TURN/STUN server UI for WebRTC (Jitsi integration)
- secubox-app-lyrion-bridge: Lyrion → Squeezelite → FFmpeg → Icecast pipeline
- secubox-app-squeezelite: Squeezelite audio player with FIFO output
- secubox-app-turn: TURN server with ACME SSL and Jitsi setup
- secubox-app-webradio: Icecast/ezstream web radio server

Features:
- HTTPS streaming via HAProxy (stream.gk2.secubox.in)
- Lyrion Music Server bridge for streaming playlists to Icecast
- TURN server with time-limited credential generation
- CrowdSec integration for WebRadio security
- Schedule-based radio programming with jingles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-21 17:46:54 +01:00

79 lines
1.9 KiB
Bash

#!/bin/sh /etc/rc.common
START=95
STOP=10
USE_PROCD=1
CONF_DIR="/srv/webradio/config"
MUSIC_DIR="/srv/webradio/music"
JINGLE_DIR="/srv/webradio/jingles"
LOG_DIR="/var/log/webradio"
PLAYLIST_FILE="/tmp/webradio_playlist.m3u"
start_service() {
local enabled
config_load webradio
config_get enabled main enabled '0'
[ "$enabled" != "1" ] && return 0
# Ensure directories exist
mkdir -p "$CONF_DIR" "$MUSIC_DIR" "$JINGLE_DIR" "$LOG_DIR"
# Generate configurations
/usr/sbin/webradioctl genconfig
# Start Icecast
if [ -f "$CONF_DIR/icecast.xml" ]; then
procd_open_instance icecast
procd_set_param command /usr/bin/icecast -c "$CONF_DIR/icecast.xml"
procd_set_param respawn
procd_set_param stderr 1
procd_set_param pidfile /var/run/icecast.pid
procd_close_instance
fi
# Wait for Icecast to start
sleep 2
# Start Ezstream if playlist enabled
local playlist_enabled
config_get playlist_enabled playlist enabled '0'
if [ "$playlist_enabled" = "1" ] && [ -f "$CONF_DIR/ezstream.xml" ]; then
/usr/sbin/webradioctl playlist generate
procd_open_instance ezstream
procd_set_param command /usr/bin/ezstream -c "$CONF_DIR/ezstream.xml"
procd_set_param respawn
procd_set_param stderr 1
procd_set_param pidfile /var/run/ezstream.pid
procd_close_instance
fi
# Start DarkIce if live enabled
local live_enabled
config_get live_enabled live enabled '0'
if [ "$live_enabled" = "1" ] && [ -f "$CONF_DIR/darkice.cfg" ]; then
procd_open_instance darkice
procd_set_param command /usr/bin/darkice -c "$CONF_DIR/darkice.cfg"
procd_set_param respawn
procd_set_param stderr 1
procd_set_param pidfile /var/run/darkice.pid
procd_close_instance
fi
logger -t webradio "WebRadio started"
}
stop_service() {
logger -t webradio "WebRadio stopped"
}
reload_service() {
/usr/sbin/webradioctl genconfig
/usr/sbin/webradioctl playlist generate
}
service_triggers() {
procd_add_reload_trigger "webradio"
}