An easy way to have a 24/7 audio stream of music.

Upgrade to Liquidsoap v2.0.1

+5 -4
.env.example
···
+
STREAM_NAME=Radio
+
STREAM_DESC=Our selection of music
+
STREAM_URL=https://google.com
+
STREAM_MOUNTPOINT=live
+
ICECAST_PORT=8000
ICECAST_SOURCE_PASSWORD=ASourcePassword
ICECAST_ADMIN_PASSWORD=AnAdminPassword
···
ICECAST_HOSTNAME=localhost
ICECAST_MAX_SOURCES=1
ICECAST_CHARSET=UTF-8
-
STREAM_NAME=Radio
-
STREAM_DESC=Our selection of music
-
STREAM_URL=https://google.com
-
STREAM_MOUNTPOINT=live
+8 -6
README.md
···
- Copy `.env.example` to `.env` and edit it
- Put music inside `music/`
- Run `docker-compose up -d`
-
- Listen to `http://localhost:8000/live` (if you changed `ICECAST_PORT`, edit the port in the URL)
+
- Listen to `http://localhost:8000/live`
+
- Change `8000` with your `ICECAST_PORT`, `live` with your `STREAM_MOUNTPOINT`
## Config
Everything is set in the `.env` file (or in your shell environment).
All settings are optional but please set the passwords or they will stay to the default, `hackme`.
+
- `STREAM_NAME`: A title for your stream.
+
- `STREAM_DESC`: A description for your stream.
+
- `STREAM_URL`: A URL (like your website) to show on the stream details.
+
- `STREAM_MOUNTPOINT`: The name of the mountpoint that Liquidsoap will use.
- `ICECAST_PORT`: The port to bind Icecast in the open.
- `ICECAST_SOURCE_PASSWORD`: The password to stream audio to Icecast.
- `ICECAST_ADMIN_PASSWORD`: The password for Icecast's administration.
- `ICECAST_RELAY_PASSWORD`: The password for Icecast's relays.
- `ICECAST_HOSTNAME`: The hostname of your Icecast installation.
- `ICECAST_MAX_SOURCES`: The maximum amount of sources.
-
- `STREAM_NAME`: A title for your stream.
-
- `STREAM_DESC`: A description for your stream.
-
- `STREAM_URL`: A URL (like your website) to show on the stream details.
-
- `STREAM_MOUNTPOINT`: The name of the mountpoint that Liquidsoap will use.
+
- `ICECAST_CHARSET`: Setting the encoding for the metadata.
> Note for `ICECAST_MAX_SOURCES`:
-
> If you plan to directly stream to Icecast on another mountpoint, you need to set this to `2` or more.
+
> If you plan to use this Icecast instance for more streams, you need to set this to `2` or more so you can use more mountpoints.
+3 -1
docker-compose.yml
···
- ICECAST_HOSTNAME
- ICECAST_MAX_SOURCES
- ICECAST_CHARSET
+
volumes:
+
- ./logs:/var/log/icecast
liquidsoap:
-
image: "savonet/liquidsoap:v1.4.3"
+
image: "savonet/liquidsoap:v2.0.1"
restart: always
command: ["/script.liq"]
environment:
+25 -24
script.liq
···
#!/usr/bin/liquidsoap
-
# Allow root for official docker image
-
set("init.allow_root", true)
+
# Allow root
+
settings.init.allow_root.set(true)
# Set environments if empty
if getenv("ICECAST_SOURCE_PASSWORD") == "" then
···
end
# Playlist
-
i_playlist = normalize(
-
playlist(
-
id="playlist",
-
mode="random",
-
reload=600,
-
"/music"
+
i_playlist = crossfade(
+
duration=3.0,
+
smart=true,
+
blank.eat(
+
start_blank=true,
+
max_blank=1.0,
+
threshold=-45.0,
+
playlist(
+
mode="randomize",
+
reload=1,
+
reload_mode="rounds",
+
"/music"
+
)
)
)
-
# Silence
-
i_silence = blank(id="blank")
-
-
# Fallback to Silence if Playlist dies for some reason
-
radio = fallback(
-
track_sensitive=false,
-
[ i_playlist, i_silence ]
-
)
+
# Make it safe
+
radio = mksafe(i_playlist)
# Output
output.icecast(
···
bitrate=128,
id3v2=true
),
-
name = getenv("STREAM_NAME"),
-
description = getenv("STREAM_DESC"),
-
url = getenv("STREAM_URL"),
-
mount = getenv("STREAM_MOUNTPOINT"),
-
password = getenv("ICECAST_SOURCE_PASSWORD"),
-
host = "icecast",
-
port = 8000,
-
encoding = "UTF-8",
+
name=getenv("STREAM_NAME"),
+
description=getenv("STREAM_DESC"),
+
url=getenv("STREAM_URL"),
+
mount=getenv("STREAM_MOUNTPOINT"),
+
password=getenv("ICECAST_SOURCE_PASSWORD"),
+
host="icecast",
+
port=8000,
+
encoding="UTF-8",
radio
)