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.
Files changed (67) hide show
  1. package/.github/workflows/check-formatting.yml +32 -0
  2. package/README.md +31 -5
  3. package/package.json +1 -1
  4. package/src/cli.js +104 -9
  5. package/tests/liq/audio.liq +460 -0
  6. package/tests/liq/autocue.liq +1081 -0
  7. package/tests/liq/clock.liq +14 -0
  8. package/tests/liq/cron.liq +74 -0
  9. package/tests/liq/error.liq +48 -0
  10. package/tests/liq/extra/audio.liq +677 -0
  11. package/tests/liq/extra/audioscrobbler.liq +482 -0
  12. package/tests/liq/extra/deprecations.liq +976 -0
  13. package/tests/liq/extra/externals.liq +196 -0
  14. package/tests/liq/extra/fades.liq +260 -0
  15. package/tests/liq/extra/file.liq +66 -0
  16. package/tests/liq/extra/http.liq +160 -0
  17. package/tests/liq/extra/interactive.liq +917 -0
  18. package/tests/liq/extra/metadata.liq +75 -0
  19. package/tests/liq/extra/native.liq +201 -0
  20. package/tests/liq/extra/openai.liq +150 -0
  21. package/tests/liq/extra/server.liq +177 -0
  22. package/tests/liq/extra/source.liq +476 -0
  23. package/tests/liq/extra/spinitron.liq +272 -0
  24. package/tests/liq/extra/telnet.liq +266 -0
  25. package/tests/liq/extra/video.liq +59 -0
  26. package/tests/liq/extra/visualization.liq +68 -0
  27. package/tests/liq/fades.liq +941 -0
  28. package/tests/liq/ffmpeg.liq +605 -0
  29. package/tests/liq/file.liq +387 -0
  30. package/tests/liq/getter.liq +74 -0
  31. package/tests/liq/hls.liq +329 -0
  32. package/tests/liq/http.liq +1048 -0
  33. package/tests/liq/http_codes.liq +447 -0
  34. package/tests/liq/icecast.liq +58 -0
  35. package/tests/liq/io.liq +106 -0
  36. package/tests/liq/liquidsoap.liq +31 -0
  37. package/tests/liq/list.liq +440 -0
  38. package/tests/liq/log.liq +47 -0
  39. package/tests/liq/lufs.liq +295 -0
  40. package/tests/liq/math.liq +23 -0
  41. package/tests/liq/medialib.liq +752 -0
  42. package/tests/liq/metadata.liq +253 -0
  43. package/tests/liq/nfo.liq +258 -0
  44. package/tests/liq/null.liq +71 -0
  45. package/tests/liq/playlist.liq +1347 -0
  46. package/tests/liq/predicate.liq +106 -0
  47. package/tests/liq/process.liq +93 -0
  48. package/tests/liq/profiler.liq +5 -0
  49. package/tests/liq/protocols.liq +1139 -0
  50. package/tests/liq/ref.liq +28 -0
  51. package/tests/liq/replaygain.liq +135 -0
  52. package/tests/liq/request.liq +467 -0
  53. package/tests/liq/resolvers.liq +33 -0
  54. package/tests/liq/runtime.liq +70 -0
  55. package/tests/liq/server.liq +99 -0
  56. package/tests/liq/settings.liq +41 -0
  57. package/tests/liq/socket.liq +33 -0
  58. package/tests/liq/source.liq +362 -0
  59. package/tests/liq/sqlite.liq +161 -0
  60. package/tests/liq/stdlib.liq +172 -0
  61. package/tests/liq/string.liq +476 -0
  62. package/tests/liq/switches.liq +197 -0
  63. package/tests/liq/testing.liq +37 -0
  64. package/tests/liq/thread.liq +161 -0
  65. package/tests/liq/tracks.liq +100 -0
  66. package/tests/liq/utils.liq +81 -0
  67. 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