Free range grass fed organic code to have a real http server and real air-support
This commit is contained in:
@@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y ffmpeg liquidsoap
|
||||
|
||||
WORKDIR /config
|
||||
WORKDIR /
|
||||
|
||||
RUN adduser zambla
|
||||
|
||||
@@ -13,6 +13,7 @@ COPY radio.liq /opt/radio.liq
|
||||
COPY yt_sync.py /opt
|
||||
COPY ultrasync.sh /opt
|
||||
COPY je_te_met_en_pls.py /opt
|
||||
COPY www /var/www
|
||||
|
||||
RUN curl -fsSL https://deno.land/install.sh | sh
|
||||
ENV DENO_INSTALL="/$HOME/.deno"
|
||||
@@ -22,10 +23,6 @@ RUN chmod +x /opt/yt_sync.py /opt/ultrasync.sh /opt/je_te_met_en_pls.py
|
||||
|
||||
RUN mkdir -p /songs /jingles /air-support /var/log/liquidsoap
|
||||
|
||||
RUN chown -R zambla:zambla /config
|
||||
RUN chown -R zambla:zambla /opt
|
||||
RUN chown -R zambla:zambla /songs
|
||||
RUN chown -R zambla:zambla /jingles
|
||||
RUN chown -R zambla:zambla /var/log/liquidsoap
|
||||
|
||||
ADD air-support /air-support
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
export HOSTNAME=${HOSTNAME:=localhost}
|
||||
export PORT=${PORT:=8000}
|
||||
export MAX_LISTENERS=${MAX_LISTENERS:=30}
|
||||
export ADMIN_USER=${ADMIN_USER:=admin}
|
||||
export ADMIN_PASSWORD=${ADMIN_PASSWORD:=admin}
|
||||
|
||||
runuser -l zambla 'touch /songs/playlist.pls /jingles/playlist.pls'
|
||||
touch /songs/playlist.pls /jingles/playlist.pls
|
||||
|
||||
# Start background sync process
|
||||
/opt/ultrasync.sh &
|
||||
|
||||
# fallback
|
||||
runuser -l zambla '/opt/je_te_met_en_pls.py /air-support /air-support/playlist.pls'
|
||||
python /opt/je_te_met_en_pls.py /air-support /air-support/playlist.pls
|
||||
|
||||
# Run Liquidsoap as zambla user
|
||||
runuser -l zambla -c 'liquidsoap /opt/radio.liq'
|
||||
|
||||
48
radio.liq
48
radio.liq
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/liquidsoap
|
||||
|
||||
# Radio Bullshit - Liquidsoap Configuration
|
||||
# Modern open-source streaming with automatic song/jingle alternation
|
||||
|
||||
# ============================================================================
|
||||
# CONFIGURATION
|
||||
@@ -36,12 +35,13 @@ jingles = playlist(
|
||||
)
|
||||
|
||||
# Air support (fallback audio when nothing else is available)
|
||||
# air_support = playlist(
|
||||
# mode="randomize",
|
||||
# reload_mode="watch",
|
||||
# "/air-support/playlist.pls"
|
||||
# )
|
||||
air_support = single("/air-support/Airplane_Sound_Effect.ogg")
|
||||
air_support = mksafe(
|
||||
playlist(
|
||||
mode="randomize",
|
||||
reload_mode="watch",
|
||||
"/air-support/playlist.pls"
|
||||
)
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
# ALTERNATING LOGIC
|
||||
@@ -80,34 +80,22 @@ output.harbor(
|
||||
# Enable built-in HTTP server for stream and status
|
||||
settings.harbor.bind_addrs := ["0.0.0.0"]
|
||||
|
||||
# Add a simple HTML page
|
||||
# Add static folder
|
||||
harbor.http.static(
|
||||
port=port,
|
||||
path="/static/",
|
||||
"/var/www/static"
|
||||
)
|
||||
|
||||
# Add index file
|
||||
harbor.http.register(
|
||||
port=port,
|
||||
method="GET",
|
||||
"/",
|
||||
fun (_, response) -> begin
|
||||
html = "<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Radio Bullshit</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; background: #1a1a1a; color: #fff; }
|
||||
h1 { color: #ff6b6b; }
|
||||
audio { margin: 20px; }
|
||||
a { color: #4ecdc4; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Radio Bullshit</h1>
|
||||
<p>J'ai une superbe opportunité de travail</p>
|
||||
<audio controls autoplay>
|
||||
<source src=\"/radio-bullshit\" type=\"audio/mpeg\">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<p><a href=\"/radio-bullshit.m3u\">Download M3U Playlist</a></p>
|
||||
</body>
|
||||
</html>"
|
||||
response.html(html)
|
||||
response.html(
|
||||
file.contents("/var/www/index.html")
|
||||
)
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
while true; do
|
||||
pip3 install -U yt-dlp
|
||||
runuser -l zambla -c '/opt/je_te_met_en_pls.py /songs /songs/playlist.pls' || true
|
||||
runuser -l zambla -c '/opt/je_te_met_en_pls.py /jingles /jingles/playlist.pls' || true
|
||||
runuser -l zambla -c '/opt/yt_sync.py' || true
|
||||
/opt/je_te_met_en_pls.py /songs /songs/playlist.pls || true
|
||||
/opt/je_te_met_en_pls.py /jingles /jingles/playlist.pls || true
|
||||
/opt/yt_sync.py || true
|
||||
sleep 6h
|
||||
done
|
||||
|
||||
22
www/index.html
Normal file
22
www/index.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Radio bullshit, la radio du paradis !</title>
|
||||
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="/static/favicon.ico" type="image/x-icon">
|
||||
</head>
|
||||
<body>
|
||||
<audio controls autoplay>
|
||||
<source src="/radio-bullshit" type="audio/mpeg">
|
||||
</audio>
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li><a href="/radio-bullshit">VLC Stream</a></li>
|
||||
<li><a href="/radio-bullshit.m3u">M3U file</a></li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user