diff --git a/Dockerfile b/Dockerfile index 0a8073a..3faa19c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index a0cd1f8..381d024 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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' diff --git a/radio.liq b/radio.liq index 8b89c9e..b9f6e1d 100644 --- a/radio.liq +++ b/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 = " - - - Radio Bullshit - - - -

Radio Bullshit

-

J'ai une superbe opportunité de travail

- -

Download M3U Playlist

- -" - response.html(html) + response.html( + file.contents("/var/www/index.html") + ) end ) diff --git a/ultrasync.sh b/ultrasync.sh index 605208f..58c5e7f 100644 --- a/ultrasync.sh +++ b/ultrasync.sh @@ -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 diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..b910429 --- /dev/null +++ b/www/index.html @@ -0,0 +1,22 @@ + + + + + Radio bullshit, la radio du paradis ! + + + + + + +

+

+

+ + + \ No newline at end of file diff --git a/favicon.ico b/www/static/favicon.ico similarity index 100% rename from favicon.ico rename to www/static/favicon.ico