codemirror-lang-liquidsoap 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +13 -13
- package/dist/index.js +15 -13
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/liquidsoap.grammar +9 -1
- package/src/parser.js +8 -8
- package/src/parser.terms.js +6 -5
- package/tests/liquidsoap/.github/scripts/build-posix.sh +0 -3
- package/tests/liquidsoap/.github/workflows/ci.yml +35 -10
- package/tests/liquidsoap/.pre-commit-config.yaml +1 -1
- package/tests/liquidsoap/CHANGES.md +1 -0
- package/tests/liquidsoap/CITATION.cff +17 -0
- package/tests/liquidsoap/doc/Makefile +17 -0
- package/tests/liquidsoap/doc/content/beets.md +6 -47
- package/tests/liquidsoap/doc/content/blank.md +5 -17
- package/tests/liquidsoap/doc/content/complete_case.md +1 -53
- package/tests/liquidsoap/doc/content/cookbook.md +23 -170
- package/tests/liquidsoap/doc/content/crossfade.md +1 -73
- package/tests/liquidsoap/doc/content/dynamic_sources.md +1 -47
- package/tests/liquidsoap/doc/content/external_decoders.md +6 -118
- package/tests/liquidsoap/doc/content/external_encoders.md +2 -4
- package/tests/liquidsoap/doc/content/external_streams.md +6 -20
- package/tests/liquidsoap/doc/content/ffmpeg_cookbook.md +9 -147
- package/tests/liquidsoap/doc/content/ffmpeg_filters.md +6 -93
- package/tests/liquidsoap/doc/content/harbor.md +4 -40
- package/tests/liquidsoap/doc/content/harbor_http.md +10 -118
- package/tests/liquidsoap/doc/content/help.md +1 -9
- package/tests/liquidsoap/doc/content/hls_output.md +6 -102
- package/tests/liquidsoap/doc/content/http_input.md +2 -4
- package/tests/liquidsoap/doc/content/icy_metadata.md +2 -24
- package/tests/liquidsoap/doc/content/in_production.md +2 -7
- package/tests/liquidsoap/doc/content/json.md +10 -36
- package/tests/liquidsoap/doc/content/language.md +1 -1
- package/tests/liquidsoap/doc/content/liq/Makefile +8 -0
- package/tests/liquidsoap/doc/content/liq/append-silence.liq +46 -0
- package/tests/liquidsoap/doc/content/liq/beets-amplify.liq +29 -0
- package/tests/liquidsoap/doc/content/liq/beets-protocol.liq +26 -0
- package/tests/liquidsoap/doc/content/liq/beets-source.liq +21 -0
- package/tests/liquidsoap/doc/content/liq/blank-detect.liq +10 -0
- package/tests/liquidsoap/doc/content/liq/blank-sorry.liq +11 -0
- package/tests/liquidsoap/doc/content/liq/check +4 -0
- package/tests/liquidsoap/doc/content/liq/complete-case.liq +69 -0
- package/tests/liquidsoap/doc/content/liq/cross.smart.liq +37 -0
- package/tests/liquidsoap/doc/content/liq/crossfade.liq +120 -0
- package/tests/liquidsoap/doc/content/liq/decoder-faad.liq +122 -0
- package/tests/liquidsoap/doc/content/liq/decoder-flac.liq +19 -0
- package/tests/liquidsoap/doc/content/liq/decoder-metaflac.liq +24 -0
- package/tests/liquidsoap/doc/content/liq/dump-hourly.liq +7 -0
- package/tests/liquidsoap/doc/content/liq/dump-hourly2.liq +4 -0
- package/tests/liquidsoap/doc/content/liq/dynamic-source.liq +55 -0
- package/tests/liquidsoap/doc/content/liq/external-output.file.liq +7 -0
- package/tests/liquidsoap/doc/content/liq/fallback.liq +4 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-filter-dynamic-volume.liq +36 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-filter-flanger-highpass.liq +10 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-filter-hflip.liq +9 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-filter-hflip2.liq +23 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-filter-parallel-flanger-highpass.liq +36 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-live-switch.liq +23 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-relay-ondemand.liq +31 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-relay.liq +19 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-shared-encoding-rtmp.liq +43 -0
- package/tests/liquidsoap/doc/content/liq/ffmpeg-shared-encoding.liq +28 -0
- package/tests/liquidsoap/doc/content/liq/frame-size.liq +10 -0
- package/tests/liquidsoap/doc/content/liq/harbor-auth.liq +18 -0
- package/tests/liquidsoap/doc/content/liq/harbor-insert-metadata.liq +28 -0
- package/tests/liquidsoap/doc/content/liq/harbor-metadata.liq +14 -0
- package/tests/liquidsoap/doc/content/liq/harbor-redirect.liq +10 -0
- package/tests/liquidsoap/doc/content/liq/harbor-simple.liq +10 -0
- package/tests/liquidsoap/doc/content/liq/harbor-usage.liq +16 -0
- package/tests/liquidsoap/doc/content/liq/harbor.http.register.liq +48 -0
- package/tests/liquidsoap/doc/content/liq/harbor.http.response.liq +20 -0
- package/tests/liquidsoap/doc/content/liq/hls-metadata.liq +18 -0
- package/tests/liquidsoap/doc/content/liq/hls-mp4.liq +35 -0
- package/tests/liquidsoap/doc/content/liq/http-input.liq +6 -0
- package/tests/liquidsoap/doc/content/liq/icy-update.liq +31 -0
- package/tests/liquidsoap/doc/content/liq/input.mplayer.liq +26 -0
- package/tests/liquidsoap/doc/content/liq/json-ex.liq +29 -0
- package/tests/liquidsoap/doc/content/liq/json-stringify.liq +2 -0
- package/tests/liquidsoap/doc/content/liq/json1.liq +3 -0
- package/tests/liquidsoap/doc/content/liq/liquidsoap +4 -0
- package/tests/liquidsoap/doc/content/liq/live-switch.liq +23 -0
- package/tests/liquidsoap/doc/content/liq/medialib.liq +4 -0
- package/tests/liquidsoap/doc/content/liq/multitrack-add-video-track.liq +24 -0
- package/tests/liquidsoap/doc/content/liq/multitrack-add-video-track2.liq +10 -0
- package/tests/liquidsoap/doc/content/liq/multitrack-default-video-track.liq +14 -0
- package/tests/liquidsoap/doc/content/liq/multitrack.liq +11 -0
- package/tests/liquidsoap/doc/content/liq/multitrack2.liq +16 -0
- package/tests/liquidsoap/doc/content/liq/multitrack3.liq +10 -0
- package/tests/liquidsoap/doc/content/liq/output.file.hls.liq +44 -0
- package/tests/liquidsoap/doc/content/liq/prometheus-callback.liq +18 -0
- package/tests/liquidsoap/doc/content/liq/prometheus-settings.liq +3 -0
- package/tests/liquidsoap/doc/content/liq/radiopi.liq +467 -0
- package/tests/liquidsoap/doc/content/liq/re-encode.liq +14 -0
- package/tests/liquidsoap/doc/content/liq/regular.liq +8 -0
- package/tests/liquidsoap/doc/content/liq/replaygain-metadata.liq +6 -0
- package/tests/liquidsoap/doc/content/liq/replaygain-playlist.liq +6 -0
- package/tests/liquidsoap/doc/content/liq/rtmp.liq +10 -0
- package/tests/liquidsoap/doc/content/liq/samplerate3.liq +8 -0
- package/tests/liquidsoap/doc/content/liq/scheduling.liq +7 -0
- package/tests/liquidsoap/doc/content/liq/seek-telnet.liq +23 -0
- package/tests/liquidsoap/doc/content/liq/settings.liq +8 -0
- package/tests/liquidsoap/doc/content/liq/shoutcast.liq +5 -0
- package/tests/liquidsoap/doc/content/liq/space_overhead.liq +9 -0
- package/tests/liquidsoap/doc/content/liq/split-cue.liq +21 -0
- package/tests/liquidsoap/doc/content/liq/srt-receiver.liq +8 -0
- package/tests/liquidsoap/doc/content/liq/srt-sender.liq +4 -0
- package/tests/liquidsoap/doc/content/liq/transcoding.liq +18 -0
- package/tests/liquidsoap/doc/content/liq/video-anonymizer.liq +31 -0
- package/tests/liquidsoap/doc/content/liq/video-bluescreen.liq +14 -0
- package/tests/liquidsoap/doc/content/liq/video-in-video.liq +7 -0
- package/tests/liquidsoap/doc/content/liq/video-logo.liq +9 -0
- package/tests/liquidsoap/doc/content/liq/video-osc.liq +26 -0
- package/tests/liquidsoap/doc/content/liq/video-simple.liq +12 -0
- package/tests/liquidsoap/doc/content/liq/video-static.liq +20 -0
- package/tests/liquidsoap/doc/content/liq/video-text.liq +5 -0
- package/tests/liquidsoap/doc/content/liq/video-transition.liq +5 -0
- package/tests/liquidsoap/doc/content/liq/video-weather.liq +7 -0
- package/tests/liquidsoap/doc/content/liq/video-webcam.liq +1 -0
- package/tests/liquidsoap/doc/content/memory.md +2 -14
- package/tests/liquidsoap/doc/content/multitrack.md +6 -81
- package/tests/liquidsoap/doc/content/prometheus.md +8 -22
- package/tests/liquidsoap/doc/content/quick_start.md +1 -1
- package/tests/liquidsoap/doc/content/radiopi.md +1 -298
- package/tests/liquidsoap/doc/content/replay_gain.md +2 -7
- package/tests/liquidsoap/doc/content/seek.md +2 -18
- package/tests/liquidsoap/doc/content/shoutcast.md +1 -5
- package/tests/liquidsoap/doc/content/split-cue.md +1 -26
- package/tests/liquidsoap/doc/content/video-static.md +1 -20
- package/tests/liquidsoap/doc/content/video.md +23 -111
- package/tests/liquidsoap/doc/dune +6 -0
- package/tests/liquidsoap/doc/dune.inc +11350 -406
- package/tests/liquidsoap/doc/gen_dune.ml +81 -31
- package/tests/liquidsoap/doc/no-pandoc +1 -1
- package/tests/liquidsoap/liquidsoap +2 -1
- package/tests/liquidsoap/src/core/io/srt_io.ml +12 -3
- package/tests/liquidsoap/src/core/operators/video_effects.ml +3 -1
- package/tests/liquidsoap/src/core/outputs/output.ml +4 -2
- package/tests/liquidsoap/src/core/outputs/output.mli +2 -0
- package/tests/liquidsoap/src/core/visualization/video_volume.ml +7 -4
- package/tests/liquidsoap/src/js/index.html +2 -2
- package/tests/liquidsoap/src/lang/parser.mly +10 -10
- package/tests/liquidsoap/src/lang/term/parsed_term.ml +7 -11
- package/tests/liquidsoap/src/lang/term/term_reducer.ml +32 -32
- package/tests/liquidsoap/src/lang/utils.ml +3 -3
- package/tests/liquidsoap/src/libs/file.liq +15 -2
- package/tests/liquidsoap/src/libs/playlist.liq +3 -0
- package/tests/liquidsoap/src/runtime/main.ml +3 -0
- package/tests/liquidsoap/src/tooling/parsed_json.ml +9 -10
- package/tests/liquidsoap/tests/language/file.liq +4 -0
- package/tests/liquidsoap/tests/language/record.liq +33 -0
- package/tests/liquidsoap/tests/language/regexp.liq +2 -0
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
#!/usr/bin/liquidsoap
|
|
2
|
+
|
|
3
|
+
# Standard settings
|
|
4
|
+
log.file := true
|
|
5
|
+
log.file.path := "/var/log/liquidsoap/pi.log"
|
|
6
|
+
log.stdout := false
|
|
7
|
+
init.daemon := true
|
|
8
|
+
init.daemon.pidfile.path := "/var/run/liquidsoap/pi.pid"
|
|
9
|
+
|
|
10
|
+
# Enable telnet server
|
|
11
|
+
settings.server.telnet.set(true)
|
|
12
|
+
|
|
13
|
+
# Enable harbor for any external connection
|
|
14
|
+
settings.harbor.bind_addrs.set(["0.0.0.0"])
|
|
15
|
+
|
|
16
|
+
# Verbose logs
|
|
17
|
+
log.level.set(4)
|
|
18
|
+
|
|
19
|
+
# We use the scheduler intensively,
|
|
20
|
+
# therefore we create many queues.
|
|
21
|
+
settings.scheduler.generic_queues.set(5)
|
|
22
|
+
settings.scheduler.fast_queues.set(3)
|
|
23
|
+
settings.scheduler.non_blocking_queues.set(3)
|
|
24
|
+
|
|
25
|
+
# === Settings ===
|
|
26
|
+
|
|
27
|
+
# The host to request files
|
|
28
|
+
stream = "XXXxXXXx"
|
|
29
|
+
|
|
30
|
+
# The command to request files
|
|
31
|
+
scripts =
|
|
32
|
+
"ssh XXxxxXXX@#{stream} '/path/to/scripts/"
|
|
33
|
+
|
|
34
|
+
# A substitution on the returned path
|
|
35
|
+
sed =
|
|
36
|
+
" | sed -e s#/path/to/files/#ftp://user:password@#{stream}/#'"
|
|
37
|
+
|
|
38
|
+
# Enable replay gain
|
|
39
|
+
enable_replaygain_metadata()
|
|
40
|
+
|
|
41
|
+
pass = "XXxXXXXx"
|
|
42
|
+
ice_host = "localhost"
|
|
43
|
+
|
|
44
|
+
descr = "RadioPi"
|
|
45
|
+
url = "http://radiopi.org"
|
|
46
|
+
|
|
47
|
+
# === Live ===
|
|
48
|
+
|
|
49
|
+
# A live source, on which we strip blank (make the source unavailable when
|
|
50
|
+
# streaming blank).
|
|
51
|
+
live =
|
|
52
|
+
blank.strip(
|
|
53
|
+
input.harbor(
|
|
54
|
+
id="live", port=8000, password=pass, buffer=8., max=20., "live.ogg"
|
|
55
|
+
),
|
|
56
|
+
max_blank=10.,
|
|
57
|
+
threshold=-50.
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
# This source relays the live data, when available, to the other streamer, in
|
|
61
|
+
# uncompressed format (WAV).
|
|
62
|
+
output.icecast(
|
|
63
|
+
%wav,
|
|
64
|
+
host=stream,
|
|
65
|
+
port=8005,
|
|
66
|
+
password=pass,
|
|
67
|
+
mount="live.ogg",
|
|
68
|
+
fallible=true,
|
|
69
|
+
live
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# This source relays the live source to "live.ogg". This is used for debugging
|
|
73
|
+
# purposes, to see what is sent to the harbor source.
|
|
74
|
+
output.icecast(
|
|
75
|
+
%vorbis,
|
|
76
|
+
host="127.0.0.1",
|
|
77
|
+
port=8080,
|
|
78
|
+
password=pass,
|
|
79
|
+
mount="live.ogg",
|
|
80
|
+
fallible=true,
|
|
81
|
+
live
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# This source starts an archive of the live stream when available
|
|
85
|
+
title =
|
|
86
|
+
'$(if $(title),"$(title)","Emission inconnue")$(if $(artist), " par \
|
|
87
|
+
$(artist)") - %m-%d-%Y, %H:%M:%S'
|
|
88
|
+
output.file(
|
|
89
|
+
%vorbis,
|
|
90
|
+
reopen_on_metadata=fun (_) -> true,
|
|
91
|
+
fallible=true,
|
|
92
|
+
"/data/archives/brutes/" ^ title ^ ".ogg",
|
|
93
|
+
live
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# === Channels ===
|
|
97
|
+
|
|
98
|
+
# Specialize the output functions
|
|
99
|
+
def out(fmt, ~id, ~mount, ~name, ~genre, s) =
|
|
100
|
+
output.icecast(
|
|
101
|
+
fmt,
|
|
102
|
+
id=id,
|
|
103
|
+
description=descr,
|
|
104
|
+
url=url,
|
|
105
|
+
host=ice_host,
|
|
106
|
+
port=8080,
|
|
107
|
+
password=pass,
|
|
108
|
+
fallible=true,
|
|
109
|
+
mount=mount,
|
|
110
|
+
name=name,
|
|
111
|
+
genre=genre,
|
|
112
|
+
s
|
|
113
|
+
)
|
|
114
|
+
end
|
|
115
|
+
def out_aac32(~id, ~mount, ~name, ~genre, s) =
|
|
116
|
+
out(%fdkaac(bitrate = 32), id=id, mount=mount, name=name, genre=genre, s)
|
|
117
|
+
end
|
|
118
|
+
def out_aac(~id, ~mount, ~name, ~genre, s) =
|
|
119
|
+
out(%fdkaac(bitrate = 64), id=id, mount=mount, name=name, genre=genre, s)
|
|
120
|
+
end
|
|
121
|
+
def out(~id, ~mount, ~name, ~genre, s) =
|
|
122
|
+
out(%mp3, id=id, mount=mount, name=name, genre=genre, s)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# A file for playing during failures
|
|
126
|
+
interlude = single("/home/radiopi/fallback.mp3")
|
|
127
|
+
|
|
128
|
+
# Lastfm submission
|
|
129
|
+
def lastfm(m) =
|
|
130
|
+
if
|
|
131
|
+
(m["type"] == "chansons")
|
|
132
|
+
then
|
|
133
|
+
if
|
|
134
|
+
(
|
|
135
|
+
m["canal"] == "reggae"
|
|
136
|
+
or
|
|
137
|
+
m["canal"] == "Jazz"
|
|
138
|
+
or
|
|
139
|
+
m["canal"] == "That70Sound"
|
|
140
|
+
)
|
|
141
|
+
then
|
|
142
|
+
canal =
|
|
143
|
+
if (m["canal"] == "That70Sound") then "70sound" else m["canal"] end
|
|
144
|
+
user = "radiopi-" ^ canal
|
|
145
|
+
lastfm.submit(user=user, password="xXXxx", m)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# === Basic sources ===
|
|
151
|
+
|
|
152
|
+
# Custom crossfade to deal with jingles.
|
|
153
|
+
def crossfade(
|
|
154
|
+
~start_next=5.,
|
|
155
|
+
~fade_in=3.,
|
|
156
|
+
~fade_out=3.,
|
|
157
|
+
~default=(fun (a, b) -> sequence([a, b])),
|
|
158
|
+
~high=-15.,
|
|
159
|
+
~medium=-32.,
|
|
160
|
+
~margin=4.,
|
|
161
|
+
~width=2.,
|
|
162
|
+
~conservative=false,
|
|
163
|
+
s
|
|
164
|
+
) =
|
|
165
|
+
fade_out = fun (s) -> fade.out(type="sin", duration=fade_out, s)
|
|
166
|
+
fade_in = fun (s) -> fade.in(type="sin", duration=fade_in, s)
|
|
167
|
+
add = fun (a, b) -> add(normalize=false, [b, a])
|
|
168
|
+
log = fun (~level=3, x) -> log(label="crossfade", level=level, x)
|
|
169
|
+
|
|
170
|
+
def transition(a, b) =
|
|
171
|
+
list.iter(
|
|
172
|
+
fun (x) ->
|
|
173
|
+
log(
|
|
174
|
+
level=4,
|
|
175
|
+
"Before: #{x}"
|
|
176
|
+
),
|
|
177
|
+
a.metadata
|
|
178
|
+
)
|
|
179
|
+
list.iter(
|
|
180
|
+
fun (x) ->
|
|
181
|
+
log(
|
|
182
|
+
level=4,
|
|
183
|
+
"After : #{x}"
|
|
184
|
+
),
|
|
185
|
+
b.metadata
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
if
|
|
189
|
+
a.metadata["type"] == "jingles" or b.metadata["type"] == "jingles"
|
|
190
|
+
then
|
|
191
|
+
log(
|
|
192
|
+
"Old or new file is a jingle: sequenced transition."
|
|
193
|
+
)
|
|
194
|
+
sequence([a.source, b.source])
|
|
195
|
+
elsif
|
|
196
|
+
# If A and B are not too loud and close, fully cross-fade them.
|
|
197
|
+
a.db_level <= medium
|
|
198
|
+
and
|
|
199
|
+
b.db_level <= medium
|
|
200
|
+
and
|
|
201
|
+
abs(a.db_level - b.db_level) <= margin
|
|
202
|
+
then
|
|
203
|
+
log(
|
|
204
|
+
"Old <= medium, new <= medium and |old-new| <= margin."
|
|
205
|
+
)
|
|
206
|
+
log(
|
|
207
|
+
"Old and new source are not too loud and close."
|
|
208
|
+
)
|
|
209
|
+
log(
|
|
210
|
+
"Transition: crossed, fade-in, fade-out."
|
|
211
|
+
)
|
|
212
|
+
add(fade_out(a.source), fade_in(b.source))
|
|
213
|
+
elsif
|
|
214
|
+
# If B is significantly louder than A, only fade-out A.
|
|
215
|
+
# We don't want to fade almost silent things, ask for >medium.
|
|
216
|
+
b.db_level >= a.db_level + margin
|
|
217
|
+
and
|
|
218
|
+
a.db_level >= medium
|
|
219
|
+
and
|
|
220
|
+
b.db_level <= high
|
|
221
|
+
then
|
|
222
|
+
log(
|
|
223
|
+
"new >= old + margin, old >= medium and new <= high."
|
|
224
|
+
)
|
|
225
|
+
log(
|
|
226
|
+
"New source is significantly louder than old one."
|
|
227
|
+
)
|
|
228
|
+
log(
|
|
229
|
+
"Transition: crossed, fade-out."
|
|
230
|
+
)
|
|
231
|
+
add(fade_out(a.source), b.source)
|
|
232
|
+
elsif
|
|
233
|
+
# Opposite as the previous one.
|
|
234
|
+
a.db_level >= b.db_level + margin
|
|
235
|
+
and
|
|
236
|
+
b.db_level >= medium
|
|
237
|
+
and
|
|
238
|
+
a.db_level <= high
|
|
239
|
+
then
|
|
240
|
+
log(
|
|
241
|
+
"old >= new + margin, new >= medium and old <= high"
|
|
242
|
+
)
|
|
243
|
+
log(
|
|
244
|
+
"Old source is significantly louder than new one."
|
|
245
|
+
)
|
|
246
|
+
log(
|
|
247
|
+
"Transition: crossed, fade-in."
|
|
248
|
+
)
|
|
249
|
+
add(a.source, fade_in(b.source))
|
|
250
|
+
elsif
|
|
251
|
+
# Do not fade if it's already very low.
|
|
252
|
+
b.db_level >= a.db_level + margin
|
|
253
|
+
and
|
|
254
|
+
a.db_level <= medium
|
|
255
|
+
and
|
|
256
|
+
b.db_level <= high
|
|
257
|
+
then
|
|
258
|
+
log(
|
|
259
|
+
"new >= old + margin, old <= medium and new <= high."
|
|
260
|
+
)
|
|
261
|
+
log(
|
|
262
|
+
"Do not fade if it's already very low."
|
|
263
|
+
)
|
|
264
|
+
log(
|
|
265
|
+
"Transition: crossed, no fade."
|
|
266
|
+
)
|
|
267
|
+
add(a.source, b.source)
|
|
268
|
+
|
|
269
|
+
# What to do with a loud end and a quiet beginning?
|
|
270
|
+
# A good idea is to use a jingle to separate the two tracks,
|
|
271
|
+
# but that's another story.
|
|
272
|
+
else
|
|
273
|
+
# Otherwise, A and B are just too loud to overlap nicely, or the
|
|
274
|
+
# difference between them is too large and overlapping would completely
|
|
275
|
+
# mask one of them.
|
|
276
|
+
log(
|
|
277
|
+
"No transition: using default."
|
|
278
|
+
)
|
|
279
|
+
default(a.source, b.source)
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
cross(
|
|
284
|
+
width=width, duration=start_next, conservative=conservative, transition, s
|
|
285
|
+
)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Create a radiopilote-driven source
|
|
289
|
+
def channel_radiopilote(~skip=true, name) =
|
|
290
|
+
log(
|
|
291
|
+
"Creating canal #{name}"
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
# Request function
|
|
295
|
+
def req() =
|
|
296
|
+
log(
|
|
297
|
+
"Request for #{name}"
|
|
298
|
+
)
|
|
299
|
+
ret =
|
|
300
|
+
list.hd(
|
|
301
|
+
process.read.lines(
|
|
302
|
+
scripts ^
|
|
303
|
+
"radiopilote-getnext " ^
|
|
304
|
+
process.quote(name) ^
|
|
305
|
+
sed
|
|
306
|
+
)
|
|
307
|
+
)
|
|
308
|
+
log(
|
|
309
|
+
"Got answer: #{ret} for #{name}"
|
|
310
|
+
)
|
|
311
|
+
request.create(ret)
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# Create the dynamic source. Set conservative to true to queue several songs
|
|
315
|
+
# in advance.
|
|
316
|
+
s = request.dynamic(id="dyn_" ^ name, req, timeout=60.)
|
|
317
|
+
|
|
318
|
+
# Apply normalization using replaygain information.
|
|
319
|
+
s = amplify(1., override="replay_gain", s)
|
|
320
|
+
|
|
321
|
+
# Skip blank when asked to
|
|
322
|
+
s = if skip then blank.skip(s, max_blank=10., threshold=-40.) else s end
|
|
323
|
+
|
|
324
|
+
# Submit new tracks on lastfm
|
|
325
|
+
s = source.on_metadata(s, lastfm)
|
|
326
|
+
|
|
327
|
+
# Tell the system when a new track is played
|
|
328
|
+
s =
|
|
329
|
+
source.on_metadata(
|
|
330
|
+
s,
|
|
331
|
+
fun (meta) ->
|
|
332
|
+
process.run(
|
|
333
|
+
scripts ^
|
|
334
|
+
"radiopilote-feedback " ^
|
|
335
|
+
process.quote(meta["canal"]) ^
|
|
336
|
+
" " ^
|
|
337
|
+
process.quote(meta["file_id"]) ^
|
|
338
|
+
"'"
|
|
339
|
+
)
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
# Finally apply a smart crossfading
|
|
343
|
+
crossfade(s)
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Basic source
|
|
347
|
+
jazz = channel_radiopilote("jazz")
|
|
348
|
+
discoqueen = channel_radiopilote("discoqueen")
|
|
349
|
+
|
|
350
|
+
# Avoid skipping blank with classic music !!
|
|
351
|
+
classique = channel_radiopilote(skip=false, "classique")
|
|
352
|
+
That70Sound = channel_radiopilote("That70Sound")
|
|
353
|
+
metal = channel_radiopilote("metal")
|
|
354
|
+
reggae = channel_radiopilote("reggae")
|
|
355
|
+
Rock = channel_radiopilote("Rock")
|
|
356
|
+
|
|
357
|
+
# Group those sources in a separate
|
|
358
|
+
# clock (good for multithreading/multicore)
|
|
359
|
+
clock.assign_new([jazz, That70Sound, metal, reggae])
|
|
360
|
+
|
|
361
|
+
# === Mixing live ===
|
|
362
|
+
|
|
363
|
+
# To create a channel from a basic source, add:
|
|
364
|
+
# - a new-track notification for radiopilote
|
|
365
|
+
# - metadata rewriting
|
|
366
|
+
# - the live shows
|
|
367
|
+
# - the failsafe 'interlude' source to channels
|
|
368
|
+
# - blank detection
|
|
369
|
+
def mklive(s) =
|
|
370
|
+
# Transition function: if transitioning to the live, fade out the old source
|
|
371
|
+
# if transitioning from live, fade.in the new source. NOTE: We cannot skip the
|
|
372
|
+
# current song because reloading new songs for all the sources when live
|
|
373
|
+
# starts costs too much CPU.
|
|
374
|
+
def trans(old, new) =
|
|
375
|
+
if
|
|
376
|
+
source.id(new) == source.id(live)
|
|
377
|
+
then
|
|
378
|
+
log(
|
|
379
|
+
"Transition to live!"
|
|
380
|
+
)
|
|
381
|
+
add([new, fade.out(old)])
|
|
382
|
+
elsif
|
|
383
|
+
source.id(old) == source.id(live)
|
|
384
|
+
then
|
|
385
|
+
log(
|
|
386
|
+
"Transitioning from live!"
|
|
387
|
+
)
|
|
388
|
+
add([fade.in(new), old])
|
|
389
|
+
else
|
|
390
|
+
log(
|
|
391
|
+
"Dummy transition"
|
|
392
|
+
)
|
|
393
|
+
new
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
fallback(
|
|
397
|
+
track_sensitive=false,
|
|
398
|
+
transitions=[trans, trans, trans],
|
|
399
|
+
[live, (s : source), interlude]
|
|
400
|
+
)
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
# Create a channel using mklive(), encode and output it to icecast.
|
|
404
|
+
def mkoutput(~out=out, mount, source, name, genre) =
|
|
405
|
+
out(id=(mount : string), mount=mount, name=name, genre=genre, mklive(source))
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
# === Outputs ===
|
|
409
|
+
|
|
410
|
+
mkoutput(
|
|
411
|
+
"jazz",
|
|
412
|
+
jazz,
|
|
413
|
+
"RadioPi - Canal Jazz",
|
|
414
|
+
"jazz"
|
|
415
|
+
)
|
|
416
|
+
mkoutput(
|
|
417
|
+
"discoqueen",
|
|
418
|
+
discoqueen,
|
|
419
|
+
"RadioPi - Canal DiscoQueen",
|
|
420
|
+
"discoqueen"
|
|
421
|
+
)
|
|
422
|
+
mkoutput(
|
|
423
|
+
"classique",
|
|
424
|
+
classique,
|
|
425
|
+
"RadioPi - Canal Classique",
|
|
426
|
+
"classique"
|
|
427
|
+
)
|
|
428
|
+
mkoutput(
|
|
429
|
+
"That70Sound",
|
|
430
|
+
That70Sound,
|
|
431
|
+
"RadioPi - Canal That70Sound",
|
|
432
|
+
"That70Sound"
|
|
433
|
+
)
|
|
434
|
+
mkoutput(
|
|
435
|
+
"metal",
|
|
436
|
+
metal,
|
|
437
|
+
"RadioPi - Canal Metal",
|
|
438
|
+
"metal"
|
|
439
|
+
)
|
|
440
|
+
mkoutput(
|
|
441
|
+
"reggae",
|
|
442
|
+
reggae,
|
|
443
|
+
"RadioPi - Canal Reggae",
|
|
444
|
+
"reggae"
|
|
445
|
+
)
|
|
446
|
+
mkoutput(
|
|
447
|
+
"Rock",
|
|
448
|
+
Rock,
|
|
449
|
+
"RadioPi - Canal Rock",
|
|
450
|
+
"Rock"
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
# Test outouts
|
|
454
|
+
mkoutput(
|
|
455
|
+
out=out_aac,
|
|
456
|
+
"reggae.aacp",
|
|
457
|
+
reggae,
|
|
458
|
+
"RadioPi - Canal Reggae (64 kbits AAC+ test stream)",
|
|
459
|
+
"reggae"
|
|
460
|
+
)
|
|
461
|
+
mkoutput(
|
|
462
|
+
out=out_aac32,
|
|
463
|
+
"reggae.aacp32",
|
|
464
|
+
reggae,
|
|
465
|
+
"RadioPi - Canal Reggae (32 kbits AAC+ test stream)",
|
|
466
|
+
"reggae"
|
|
467
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# The input file, any format supported by liquidsoap
|
|
2
|
+
input = "/tmp/input.mp3"
|
|
3
|
+
|
|
4
|
+
# The output file
|
|
5
|
+
target = "/tmp/output.ogg"
|
|
6
|
+
|
|
7
|
+
# A source that plays the file once
|
|
8
|
+
source = once(single(input))
|
|
9
|
+
|
|
10
|
+
# We use a clock with disabled synchronization
|
|
11
|
+
clock.assign_new(sync="none", [source])
|
|
12
|
+
|
|
13
|
+
# Finally, we output the source to an ogg/vorbis file
|
|
14
|
+
output.file(%vorbis, target, fallible=true, on_stop=shutdown, source)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# A playlist source
|
|
2
|
+
s = playlist("/path/to/music")
|
|
3
|
+
|
|
4
|
+
# The server seeking function
|
|
5
|
+
def seek(t) =
|
|
6
|
+
t = float_of_string(default=0., t)
|
|
7
|
+
log(
|
|
8
|
+
"Seeking #{t} sec"
|
|
9
|
+
)
|
|
10
|
+
ret = source.seek(s, t)
|
|
11
|
+
"Seeked #{ret} seconds."
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Register the function
|
|
15
|
+
server.register(
|
|
16
|
+
namespace=source.id(s),
|
|
17
|
+
description=
|
|
18
|
+
"Seek to a relative position in source #{source.id(s)}",
|
|
19
|
+
usage=
|
|
20
|
+
"seek <duration>",
|
|
21
|
+
"seek",
|
|
22
|
+
seek
|
|
23
|
+
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!./liquidsoap
|
|
2
|
+
# This code was contributed by AzuraCast. Possible settings:
|
|
3
|
+
# - less memory: space_overhead = 20
|
|
4
|
+
# - less cpu: space_overhead = 140
|
|
5
|
+
# - balanced: space_overhead = 80
|
|
6
|
+
|
|
7
|
+
# Optimize for memory usage over CPU: this results in a slightly increased CPU
|
|
8
|
+
# usage and reduced memory usage.
|
|
9
|
+
runtime.gc.set(runtime.gc.get().{space_overhead=20, allocation_policy=2})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Log to stdout
|
|
2
|
+
log.file := false
|
|
3
|
+
log.stdout := true
|
|
4
|
+
log.level := 4
|
|
5
|
+
|
|
6
|
+
# Initial playlist
|
|
7
|
+
cue = "/path/to/sheet.cue"
|
|
8
|
+
|
|
9
|
+
# Create a playlist with this CUE sheet and tell Liquidsoap to shutdown when we
|
|
10
|
+
# are done.
|
|
11
|
+
s = playlist(cue, on_done=shutdown)
|
|
12
|
+
|
|
13
|
+
# Add a cue_cut to cue-in/cue-out according to markers in `sheet.cue`.
|
|
14
|
+
s = cue_cut(s)
|
|
15
|
+
|
|
16
|
+
# Shove all that to a output.file operator.
|
|
17
|
+
output.file(%mp3(id3v2=true,bitrate=320),
|
|
18
|
+
fallible=true,
|
|
19
|
+
reopen_on_metadata=fun(_) -> true,
|
|
20
|
+
"/path/to/$(track) - $(title).mp3",
|
|
21
|
+
s)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Input the stream from an Icecast server or any other source
|
|
2
|
+
url = "https://icecast.radiofrance.fr/fip-hifi.aac"
|
|
3
|
+
input = mksafe(input.http(url))
|
|
4
|
+
|
|
5
|
+
# First transcoder: mp3 32 kbps. We also degrade the samplerate, and encode in
|
|
6
|
+
# mono Accordingly, a mono conversion is performed on the input stream
|
|
7
|
+
output.icecast(
|
|
8
|
+
%mp3(bitrate=32, samplerate=22050, stereo=false),
|
|
9
|
+
mount="/your-stream-32.mp3",
|
|
10
|
+
host="streaming.example.com", port=8000, password="xxx",
|
|
11
|
+
mean(input))
|
|
12
|
+
|
|
13
|
+
# Second transcoder: mp3 128 kbps using %ffmpeg
|
|
14
|
+
output.icecast(
|
|
15
|
+
%ffmpeg(format="mp3", %audio(codec="libmp3lame", b="128k")),
|
|
16
|
+
mount="/your-stream-128.mp3",
|
|
17
|
+
host="streaming.example.com", port=8000, password="xxx",
|
|
18
|
+
input)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Input from webcam
|
|
2
|
+
cam = input.v4l2()
|
|
3
|
+
|
|
4
|
+
# Detect faces (this generates a white disk over faces)
|
|
5
|
+
mask = video.frei0r.opencvfacedetect(cam)
|
|
6
|
+
# Pixellize the video
|
|
7
|
+
censored = video.frei0r.pixeliz0r(block_width=0.1, block_height=0.1, cam)
|
|
8
|
+
# Generate a mask for video without the face
|
|
9
|
+
unmask = video.frei0r.invert0r(mask)
|
|
10
|
+
# Put the pixellized face over the video
|
|
11
|
+
s = video.frei0r.addition(
|
|
12
|
+
video.frei0r.multiply(mask, censored),
|
|
13
|
+
video.frei0r.multiply(unmask, cam))
|
|
14
|
+
# We have to bufferize the source because its clock it GStreamer's clock
|
|
15
|
+
s = buffer(buffer=0.1,mksafe(s))
|
|
16
|
+
|
|
17
|
+
# Input audio from microphone
|
|
18
|
+
mic = input.pulseaudio()
|
|
19
|
+
# Transpose sound to generate a funny voice
|
|
20
|
+
mic = soundtouch(pitch=1.5, buffer(mic))
|
|
21
|
+
# Add sound to video
|
|
22
|
+
s = source.mux.audio(audio=mic, s)
|
|
23
|
+
|
|
24
|
+
# Let's hear the sound
|
|
25
|
+
output.pulseaudio(fallible=true, s)
|
|
26
|
+
# Let's see the video
|
|
27
|
+
output.sdl(fallible=true, s)
|
|
28
|
+
|
|
29
|
+
s = mksafe(s)
|
|
30
|
+
# Output the video/sound into a file in theora/vorbis format
|
|
31
|
+
output.file(%ogg(%theora(quality=63),%vorbis), "anonymous.ogv", s)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# The video of the bunny
|
|
2
|
+
s = single("big_buck_bunny_720p_stereo.ogg")
|
|
3
|
+
# Input from the webcam
|
|
4
|
+
cam = input.v4l2()
|
|
5
|
+
# Flip the video around a vertical axis so that it is easier to position
|
|
6
|
+
# yourself
|
|
7
|
+
cam = video.frei0r.flippo(x_axis=true, cam)
|
|
8
|
+
# Make the white background transparent I had to tweak the precision parameter
|
|
9
|
+
# so that I will be seen but not the wall
|
|
10
|
+
cam = video.alpha.of_color(color=0xffffff, precision=0.64, cam)
|
|
11
|
+
# Superpose the two videos
|
|
12
|
+
s = add([s,cam])
|
|
13
|
+
# Output to SDL
|
|
14
|
+
output.sdl(fallible=true, s)
|