liquidsoap-prettier 1.8.2 → 1.8.3
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/.github/workflows/check-formatting.yml +32 -0
- package/README.md +31 -5
- package/package.json +1 -1
- package/src/cli.js +104 -9
- package/tests/liq/audio.liq +460 -0
- package/tests/liq/autocue.liq +1081 -0
- package/tests/liq/clock.liq +14 -0
- package/tests/liq/cron.liq +74 -0
- package/tests/liq/error.liq +48 -0
- package/tests/liq/extra/audio.liq +677 -0
- package/tests/liq/extra/audioscrobbler.liq +482 -0
- package/tests/liq/extra/deprecations.liq +976 -0
- package/tests/liq/extra/externals.liq +196 -0
- package/tests/liq/extra/fades.liq +260 -0
- package/tests/liq/extra/file.liq +66 -0
- package/tests/liq/extra/http.liq +160 -0
- package/tests/liq/extra/interactive.liq +917 -0
- package/tests/liq/extra/metadata.liq +75 -0
- package/tests/liq/extra/native.liq +201 -0
- package/tests/liq/extra/openai.liq +150 -0
- package/tests/liq/extra/server.liq +177 -0
- package/tests/liq/extra/source.liq +476 -0
- package/tests/liq/extra/spinitron.liq +272 -0
- package/tests/liq/extra/telnet.liq +266 -0
- package/tests/liq/extra/video.liq +59 -0
- package/tests/liq/extra/visualization.liq +68 -0
- package/tests/liq/fades.liq +941 -0
- package/tests/liq/ffmpeg.liq +605 -0
- package/tests/liq/file.liq +387 -0
- package/tests/liq/getter.liq +74 -0
- package/tests/liq/hls.liq +329 -0
- package/tests/liq/http.liq +1048 -0
- package/tests/liq/http_codes.liq +447 -0
- package/tests/liq/icecast.liq +58 -0
- package/tests/liq/io.liq +106 -0
- package/tests/liq/liquidsoap.liq +31 -0
- package/tests/liq/list.liq +440 -0
- package/tests/liq/log.liq +47 -0
- package/tests/liq/lufs.liq +295 -0
- package/tests/liq/math.liq +23 -0
- package/tests/liq/medialib.liq +752 -0
- package/tests/liq/metadata.liq +253 -0
- package/tests/liq/nfo.liq +258 -0
- package/tests/liq/null.liq +71 -0
- package/tests/liq/playlist.liq +1347 -0
- package/tests/liq/predicate.liq +106 -0
- package/tests/liq/process.liq +93 -0
- package/tests/liq/profiler.liq +5 -0
- package/tests/liq/protocols.liq +1139 -0
- package/tests/liq/ref.liq +28 -0
- package/tests/liq/replaygain.liq +135 -0
- package/tests/liq/request.liq +467 -0
- package/tests/liq/resolvers.liq +33 -0
- package/tests/liq/runtime.liq +70 -0
- package/tests/liq/server.liq +99 -0
- package/tests/liq/settings.liq +41 -0
- package/tests/liq/socket.liq +33 -0
- package/tests/liq/source.liq +362 -0
- package/tests/liq/sqlite.liq +161 -0
- package/tests/liq/stdlib.liq +172 -0
- package/tests/liq/string.liq +476 -0
- package/tests/liq/switches.liq +197 -0
- package/tests/liq/testing.liq +37 -0
- package/tests/liq/thread.liq +161 -0
- package/tests/liq/tracks.liq +100 -0
- package/tests/liq/utils.liq +81 -0
- package/tests/liq/video.liq +918 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Create a new clock and assign it to a list of sources.
|
|
2
|
+
# @category Liquidsoap
|
|
3
|
+
# @param ~sync Synchronization mode. One of: `"auto"`, `"cpu"`, `"passive"` or \
|
|
4
|
+
# `"none"`. Defaults to `"auto"`, which synchronizes with the CPU \
|
|
5
|
+
# clock if none of the active sources are attached to their own \
|
|
6
|
+
# clock (e.g. ALSA input, etc). `"cpu"` always synchronizes with \
|
|
7
|
+
# the CPU clock. `"none"` removes all synchronization control.
|
|
8
|
+
# @param ~on_error Error callback executed when a streaming error occurs. \
|
|
9
|
+
# When passed, all streaming errors are silenced. Intended \
|
|
10
|
+
# mostly for debugging purposes.
|
|
11
|
+
def clock.assign_new(~sync="auto", ~id=null, ~on_error=null, sources) =
|
|
12
|
+
c = clock.create(id=id, sync=sync, on_error=on_error)
|
|
13
|
+
list.iter(fun (s) -> c.unify(s.clock), sources)
|
|
14
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
let cron.tab = ref([])
|
|
2
|
+
|
|
3
|
+
# Add an entry to the cron tab.
|
|
4
|
+
# @param ~id Optional task ID.
|
|
5
|
+
# @param c Cron entry
|
|
6
|
+
# @param handler Function to execute
|
|
7
|
+
# @method id ID to be used to remove the task.
|
|
8
|
+
# @category Programming
|
|
9
|
+
def cron.add(~id=null, c, handler) =
|
|
10
|
+
id = id ?? string.id.default(default="cron.task", null)
|
|
11
|
+
|
|
12
|
+
if
|
|
13
|
+
list.exists(fun ({id = i}) -> i == id, cron.tab())
|
|
14
|
+
then
|
|
15
|
+
error.raise(
|
|
16
|
+
error.invalid,
|
|
17
|
+
"Cron tab entry with ID #{id} already exists!"
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
let {test} = cron.parse(c)
|
|
22
|
+
log.info(
|
|
23
|
+
label="cron",
|
|
24
|
+
"Adding cron.tab entry #{c} (cron id: #{id})"
|
|
25
|
+
)
|
|
26
|
+
cron.tab :=
|
|
27
|
+
[...cron.tab(), {id = id, cron = c, test = test, handler = handler}]
|
|
28
|
+
|
|
29
|
+
{id = id}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Remove a cron tab entry. ID is returned during
|
|
33
|
+
# the task's registration
|
|
34
|
+
# @category Programming
|
|
35
|
+
def cron.remove(id) =
|
|
36
|
+
if
|
|
37
|
+
list.exists(fun ({id = i}) -> i == id, cron.tab())
|
|
38
|
+
then
|
|
39
|
+
log.info(
|
|
40
|
+
label="cron",
|
|
41
|
+
"Removing cron.tab entry #{id}"
|
|
42
|
+
)
|
|
43
|
+
cron.tab := list.filter(fun ({id = i}) -> i != id, cron.tab())
|
|
44
|
+
else
|
|
45
|
+
log.important(
|
|
46
|
+
label="cron",
|
|
47
|
+
"Cannot remove cron.tab entry #{id}: entry does not exist!"
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Main cron thread.
|
|
53
|
+
thread.when(
|
|
54
|
+
fast=false,
|
|
55
|
+
every=20.,
|
|
56
|
+
{0s-30s},
|
|
57
|
+
{
|
|
58
|
+
list.iter(
|
|
59
|
+
fun ({id, cron, test, handler}) ->
|
|
60
|
+
begin
|
|
61
|
+
if
|
|
62
|
+
test()
|
|
63
|
+
then
|
|
64
|
+
log.info(
|
|
65
|
+
label="cron",
|
|
66
|
+
"Executing cron.tab entry #{cron} (id: #{id})"
|
|
67
|
+
)
|
|
68
|
+
thread.run(fast=false, handler)
|
|
69
|
+
end
|
|
70
|
+
end,
|
|
71
|
+
cron.tab()
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
let error.assertion = error.register("assertion")
|
|
2
|
+
let error.clock = error.register("clock")
|
|
3
|
+
let error.eval = error.register("eval")
|
|
4
|
+
let error.file = error.register("file")
|
|
5
|
+
let error.file.cross_device = error.register("file.cross_device")
|
|
6
|
+
let error.http = error.register("http")
|
|
7
|
+
let error.invalid = error.register("invalid")
|
|
8
|
+
let error.json = error.register("json")
|
|
9
|
+
let error.not_found = error.register("not_found")
|
|
10
|
+
let error.output = error.register("output")
|
|
11
|
+
let error.socket = error.register("socket")
|
|
12
|
+
let error.string = error.register("string")
|
|
13
|
+
|
|
14
|
+
# Ensure that a condition is satisfied (raise `error.assertion` exception
|
|
15
|
+
# otherwise).
|
|
16
|
+
# @category Programming
|
|
17
|
+
# @param c Condition which should be satisfied.
|
|
18
|
+
def assert(c) =
|
|
19
|
+
if
|
|
20
|
+
not c
|
|
21
|
+
then
|
|
22
|
+
error.raise(
|
|
23
|
+
error.assertion,
|
|
24
|
+
"Assertion failed."
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
let error.failure = error.register("failure")
|
|
30
|
+
|
|
31
|
+
# Major failure.
|
|
32
|
+
# @category Programming
|
|
33
|
+
# @param msg Explanation about the failure.
|
|
34
|
+
def failwith(msg) =
|
|
35
|
+
error.raise(error.failure, msg)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Return error kind
|
|
39
|
+
# @category Programming
|
|
40
|
+
def error.kind(err) =
|
|
41
|
+
error.methods(err).kind
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Return error message
|
|
45
|
+
# @category Programming
|
|
46
|
+
def error.message(err) =
|
|
47
|
+
error.methods(err).message
|
|
48
|
+
end
|