1#!/usr/bin/liquidsoap
2# Allow root
3settings.init.allow_root.set(true)
4
5# Set environments if empty
6if getenv("ICECAST_SOURCE_PASSWORD") == "" then
7 setenv("ICECAST_SOURCE_PASSWORD", "hackme")
8end
9if getenv("STREAM_NAME") == "" then
10 setenv("STREAM_NAME", "Radio")
11end
12if getenv("STREAM_DESC") == "" then
13 setenv("STREAM_DESC", "Our selection of music")
14end
15if getenv("STREAM_MOUNTPOINT") == "" then
16 setenv("STREAM_MOUNTPOINT", "live")
17end
18
19# Playlist
20i_playlist = crossfade(
21 duration=3.0,
22 smart=true,
23 blank.eat(
24 start_blank=true,
25 max_blank=1.0,
26 threshold=-45.0,
27 playlist(
28 mode="randomize",
29 reload=1,
30 reload_mode="rounds",
31 "/music"
32 )
33 )
34)
35
36# Make it safe
37radio = mksafe(i_playlist)
38
39# Output
40output.icecast(
41 %mp3(
42 bitrate=128,
43 id3v2=true
44 ),
45 name=getenv("STREAM_NAME"),
46 description=getenv("STREAM_DESC"),
47 url=getenv("STREAM_URL"),
48 mount=getenv("STREAM_MOUNTPOINT"),
49 password=getenv("ICECAST_SOURCE_PASSWORD"),
50 host="icecast",
51 port=8000,
52 encoding="UTF-8",
53 radio
54)