diff --git a/.env.example b/.env.example index f84be4c..f84d1e3 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,8 @@ +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 @@ -5,7 +10,3 @@ ICECAST_RELAY_PASSWORD=APasswordForRelaysIGuess 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 diff --git a/README.md b/README.md index ade7019..49d4406 100644 --- a/README.md +++ b/README.md @@ -10,22 +10,24 @@ - 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. diff --git a/docker-compose.yml b/docker-compose.yml index cbe738a..0125c94 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,9 +13,11 @@ services: - 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: diff --git a/script.liq b/script.liq index 1b19b08..8d1162b 100644 --- a/script.liq +++ b/script.liq @@ -1,6 +1,6 @@ #!/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 @@ -17,23 +17,24 @@ if getenv("STREAM_MOUNTPOINT") == "" 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( @@ -41,13 +42,13 @@ 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 )