master
Kody 2019-12-03 23:09:39 +01:00
commit 41be45e0b8
6 changed files with 103 additions and 0 deletions

6
.env.example Normal file
View File

@ -0,0 +1,6 @@
ICECAST_PORT=8000
ICECAST_SOURCE_PASSWORD=ASourcePassword
ICECAST_ADMIN_PASSWORD=AnAdminPassword
STREAM_NAME=Radio
STREAM_DESC=Our selection of music
STREAM_URL=https://google.com

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.log
.env

24
README.md Normal file
View File

@ -0,0 +1,24 @@
# AutoRadio
> An easy way to have a 24/7 audio stream of music.
## Requirements
- docker
- docker-compose
- Some music
## Install
- Copy `.env.example` to `.env` and edit it
- Put music inside `music/`
- Run `docker-compose up -d --build`
- Listen to `http://localhost:8000/live` (if you changed `ICECAST_PORT`, edit the port in the URL)
## Config
Everything is set in the `.env` file (or your shell environment).
All settings are optional but please set the two passwords or it will stay to the default, `hackme`.
- `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.
- `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.

24
docker-compose.yml Normal file
View File

@ -0,0 +1,24 @@
version: '3'
services:
icecast:
image: "infiniteproject/icecast"
ports:
- "${ICECAST_PORT:-8000}:8000"
environment:
- ICECAST_SOURCE_PASSWORD
- ICECAST_ADMIN_PASSWORD
liquidsoap:
image: "phasecorex/liquidsoap"
command: ["/script.liq"]
environment:
- ICECAST_SOURCE_PASSWORD
- STREAM_NAME
- STREAM_DESC
- STREAM_URL
depends_on:
- icecast
volumes:
- ./music:/music:ro
- ./script.liq:/script.liq:ro

2
music/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

45
script.liq Normal file
View File

@ -0,0 +1,45 @@
# Set environments if empty
if getenv("ICECAST_SOURCE_PASSWORD") == "" then
setenv("ICECAST_SOURCE_PASSWORD", "hackme")
end
if getenv("STREAM_NAME") == "" then
setenv("STREAM_NAME", "Radio")
end
if getenv("STREAM_DESC") == "" then
setenv("STREAM_DESC", "Our selection of music")
end
# Playlist
i_playlist = normalize(
playlist(
id="playlist",
mode="random",
reload=600,
"/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 ]
)
# Output
output.icecast(
%mp3(
bitrate=128,
id3v2=true
),
name = getenv("STREAM_NAME"),
description = getenv("STREAM_DESC"),
url = getenv("STREAM_URL"),
mount = "live",
password = getenv("ICECAST_SOURCE_PASSWORD"),
host = "icecast",
port = 8000,
radio
)