codemirror-lang-liquidsoap 0.1.0
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/ci.yml +20 -0
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/cli.js +162 -0
- package/dist/index.js +44 -0
- package/dist/liquidsoap-0dac1347.js +232 -0
- package/dist/liquidsoap-18e69476.js +232 -0
- package/dist/liquidsoap-826221b5.js +232 -0
- package/dist/liquidsoap-897c55ac.js +232 -0
- package/dist/liquidsoap-a11e5e7f.js +232 -0
- package/dist/liquidsoap-c12c37dd.js +232 -0
- package/dist/liquidsoap-c4fc76fd.js +232 -0
- package/dist/liquidsoap-f8672f59.js +232 -0
- package/package.json +45 -0
- package/rollup.config.js +13 -0
- package/src/cli.ts +166 -0
- package/src/index.ts +43 -0
- package/src/liquidsoap.grammar +788 -0
- package/src/liquidsoap.grammar.d.ts +3 -0
- package/src/parser.js +19 -0
- package/src/parser.terms.js +84 -0
- package/src/tokens.js +207 -0
- package/tests/liquidsoap/.codespellignore +14 -0
- package/tests/liquidsoap/.gitattributes +2 -0
- package/tests/liquidsoap/.github/FUNDING.yml +12 -0
- package/tests/liquidsoap/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- package/tests/liquidsoap/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- package/tests/liquidsoap/.github/ISSUE_TEMPLATE/question.md +13 -0
- package/tests/liquidsoap/.github/alpine/APKBUILD-minimal.in +29 -0
- package/tests/liquidsoap/.github/alpine/APKBUILD.in +28 -0
- package/tests/liquidsoap/.github/alpine/liquidsoap.pre-install +7 -0
- package/tests/liquidsoap/.github/debian/compat +1 -0
- package/tests/liquidsoap/.github/debian/control.in +118 -0
- package/tests/liquidsoap/.github/debian/dirs +4 -0
- package/tests/liquidsoap/.github/debian/install +3 -0
- package/tests/liquidsoap/.github/debian/manpages +1 -0
- package/tests/liquidsoap/.github/debian/postinst +40 -0
- package/tests/liquidsoap/.github/debian/postrm +11 -0
- package/tests/liquidsoap/.github/debian/rules +29 -0
- package/tests/liquidsoap/.github/debian/rules-minimal +30 -0
- package/tests/liquidsoap/.github/debian/source/format +1 -0
- package/tests/liquidsoap/.github/docker/Dockerfile-armhf.production +35 -0
- package/tests/liquidsoap/.github/docker/Dockerfile.production +35 -0
- package/tests/liquidsoap/.github/docker/Dockerfile.production-alpine +16 -0
- package/tests/liquidsoap/.github/docker/Dockerfile.website +63 -0
- package/tests/liquidsoap/.github/opam/liquidsoap-core-windows.opam +181 -0
- package/tests/liquidsoap/.github/opam/packages/duppy/duppy.0.9.3/opam +37 -0
- package/tests/liquidsoap/.github/opam/packages/ssl/ssl.0.7.0/opam +40 -0
- package/tests/liquidsoap/.github/opam/repo +1 -0
- package/tests/liquidsoap/.github/scripts/add-local-opam-packages.sh +17 -0
- package/tests/liquidsoap/.github/scripts/build-apk.sh +102 -0
- package/tests/liquidsoap/.github/scripts/build-deb.sh +109 -0
- package/tests/liquidsoap/.github/scripts/build-details.sh +84 -0
- package/tests/liquidsoap/.github/scripts/build-doc.sh +12 -0
- package/tests/liquidsoap/.github/scripts/build-docker-alpine.sh +32 -0
- package/tests/liquidsoap/.github/scripts/build-docker.sh +40 -0
- package/tests/liquidsoap/.github/scripts/build-posix.sh +99 -0
- package/tests/liquidsoap/.github/scripts/build-website.sh +15 -0
- package/tests/liquidsoap/.github/scripts/build-win32.sh +82 -0
- package/tests/liquidsoap/.github/scripts/checkout-deps.sh +18 -0
- package/tests/liquidsoap/.github/scripts/export-metrics.sh +17 -0
- package/tests/liquidsoap/.github/scripts/push-docker.sh +72 -0
- package/tests/liquidsoap/.github/scripts/stats-posix.sh +20 -0
- package/tests/liquidsoap/.github/scripts/test-posix.sh +16 -0
- package/tests/liquidsoap/.github/stale.yml +22 -0
- package/tests/liquidsoap/.github/win32/log/.keep +0 -0
- package/tests/liquidsoap/.github/win32/run/.keep +0 -0
- package/tests/liquidsoap/.github/win32/test.liq +26 -0
- package/tests/liquidsoap/.github/workflows/ci.yml +704 -0
- package/tests/liquidsoap/.ocamlformat +10 -0
- package/tests/liquidsoap/.pre-commit-config.yaml +60 -0
- package/tests/liquidsoap/CHANGES.md +2300 -0
- package/tests/liquidsoap/COPYING +340 -0
- package/tests/liquidsoap/Makefile +4 -0
- package/tests/liquidsoap/README.md +121 -0
- package/tests/liquidsoap/RELEASING +19 -0
- package/tests/liquidsoap/ROADMAP.md +69 -0
- package/tests/liquidsoap/doc/content/beets.md +179 -0
- package/tests/liquidsoap/doc/content/blank.md +50 -0
- package/tests/liquidsoap/doc/content/book.md +11 -0
- package/tests/liquidsoap/doc/content/build.md +112 -0
- package/tests/liquidsoap/doc/content/clocks.md +312 -0
- package/tests/liquidsoap/doc/content/complete_case.md +81 -0
- package/tests/liquidsoap/doc/content/cookbook.md +518 -0
- package/tests/liquidsoap/doc/content/crossfade.md +98 -0
- package/tests/liquidsoap/doc/content/custom-path.md +77 -0
- package/tests/liquidsoap/doc/content/documentation.md +88 -0
- package/tests/liquidsoap/doc/content/dynamic_sources.md +72 -0
- package/tests/liquidsoap/doc/content/encoding_formats.md +279 -0
- package/tests/liquidsoap/doc/content/external_decoders.md +215 -0
- package/tests/liquidsoap/doc/content/external_encoders.md +60 -0
- package/tests/liquidsoap/doc/content/external_streams.md +49 -0
- package/tests/liquidsoap/doc/content/faq.md +224 -0
- package/tests/liquidsoap/doc/content/ffmpeg.md +324 -0
- package/tests/liquidsoap/doc/content/ffmpeg_cookbook.md +211 -0
- package/tests/liquidsoap/doc/content/ffmpeg_encoder.md +175 -0
- package/tests/liquidsoap/doc/content/ffmpeg_filters.md +251 -0
- package/tests/liquidsoap/doc/content/flows_devel.md +39 -0
- package/tests/liquidsoap/doc/content/frequence3.md +13 -0
- package/tests/liquidsoap/doc/content/geekradio.md +43 -0
- package/tests/liquidsoap/doc/content/gstreamer_encoder.md +154 -0
- package/tests/liquidsoap/doc/content/harbor.md +126 -0
- package/tests/liquidsoap/doc/content/harbor_http.md +263 -0
- package/tests/liquidsoap/doc/content/help.md +135 -0
- package/tests/liquidsoap/doc/content/hls_output.md +162 -0
- package/tests/liquidsoap/doc/content/http_input.md +17 -0
- package/tests/liquidsoap/doc/content/icy_metadata.md +75 -0
- package/tests/liquidsoap/doc/content/in_production.md +25 -0
- package/tests/liquidsoap/doc/content/index.md +61 -0
- package/tests/liquidsoap/doc/content/install.md +113 -0
- package/tests/liquidsoap/doc/content/json.md +333 -0
- package/tests/liquidsoap/doc/content/ladspa.md +42 -0
- package/tests/liquidsoap/doc/content/language.md +1382 -0
- package/tests/liquidsoap/doc/content/memory.md +135 -0
- package/tests/liquidsoap/doc/content/metadata.md +118 -0
- package/tests/liquidsoap/doc/content/migrating.md +475 -0
- package/tests/liquidsoap/doc/content/multitrack.md +357 -0
- package/tests/liquidsoap/doc/content/on2.md +28 -0
- package/tests/liquidsoap/doc/content/on2_part1.md +301 -0
- package/tests/liquidsoap/doc/content/on2_part2.md +849 -0
- package/tests/liquidsoap/doc/content/on2_part3.md +321 -0
- package/tests/liquidsoap/doc/content/phases.md +23 -0
- package/tests/liquidsoap/doc/content/playlist_parsers.md +58 -0
- package/tests/liquidsoap/doc/content/presentations.md +30 -0
- package/tests/liquidsoap/doc/content/profiling.md +33 -0
- package/tests/liquidsoap/doc/content/prometheus.md +146 -0
- package/tests/liquidsoap/doc/content/protocols-presentation.md +59 -0
- package/tests/liquidsoap/doc/content/publications.md +28 -0
- package/tests/liquidsoap/doc/content/quick_start.md +240 -0
- package/tests/liquidsoap/doc/content/radiopi.md +342 -0
- package/tests/liquidsoap/doc/content/reference-header.md +15 -0
- package/tests/liquidsoap/doc/content/release-assets.md +9 -0
- package/tests/liquidsoap/doc/content/replay_gain.md +85 -0
- package/tests/liquidsoap/doc/content/request_sources.md +99 -0
- package/tests/liquidsoap/doc/content/requests.md +53 -0
- package/tests/liquidsoap/doc/content/rolling-release.md +10 -0
- package/tests/liquidsoap/doc/content/script_loading.md +29 -0
- package/tests/liquidsoap/doc/content/seek.md +86 -0
- package/tests/liquidsoap/doc/content/server.md +265 -0
- package/tests/liquidsoap/doc/content/shoutcast.md +39 -0
- package/tests/liquidsoap/doc/content/sources.md +138 -0
- package/tests/liquidsoap/doc/content/split-cue.md +36 -0
- package/tests/liquidsoap/doc/content/stereotool.md +54 -0
- package/tests/liquidsoap/doc/content/stream_content.md +208 -0
- package/tests/liquidsoap/doc/content/strings_encoding.md +18 -0
- package/tests/liquidsoap/doc/content/video-static.md +35 -0
- package/tests/liquidsoap/doc/content/video.md +269 -0
- package/tests/liquidsoap/doc/content/yaml.md +29 -0
- package/tests/liquidsoap/doc/dune +46 -0
- package/tests/liquidsoap/doc/dune.inc +1677 -0
- package/tests/liquidsoap/doc/gen_dune.ml +130 -0
- package/tests/liquidsoap/doc/liquidsoap.1.md +142 -0
- package/tests/liquidsoap/doc/no-pandoc +1 -0
- package/tests/liquidsoap/doc/orig/css/homepage.css +148 -0
- package/tests/liquidsoap/doc/orig/css/style.css +258 -0
- package/tests/liquidsoap/doc/orig/fosdem2020/clock.png +0 -0
- package/tests/liquidsoap/doc/orig/fosdem2020/index.html +612 -0
- package/tests/liquidsoap/doc/orig/fosdem2020/logo.png +0 -0
- package/tests/liquidsoap/doc/orig/fosdem2020/radio.gif +0 -0
- package/tests/liquidsoap/doc/orig/fosdem2020/remark.js +28221 -0
- package/tests/liquidsoap/doc/orig/images/basic-radio-graph.png +0 -0
- package/tests/liquidsoap/doc/orig/images/design/background.png +0 -0
- package/tests/liquidsoap/doc/orig/images/design/background_page.png +0 -0
- package/tests/liquidsoap/doc/orig/images/design/logo.png +0 -0
- package/tests/liquidsoap/doc/orig/images/grab.png +0 -0
- package/tests/liquidsoap/doc/orig/images/graph_clocks.png +0 -0
- package/tests/liquidsoap/doc/orig/images/liqgraph.png +0 -0
- package/tests/liquidsoap/doc/orig/images/schema-webradio-inkscape.png +0 -0
- package/tests/liquidsoap/doc/orig/images/stream.png +0 -0
- package/tests/liquidsoap/doc/orig/images/tabs/tab_API.png +0 -0
- package/tests/liquidsoap/doc/orig/images/tabs/tab_about.png +0 -0
- package/tests/liquidsoap/doc/orig/images/tabs/tab_developers.png +0 -0
- package/tests/liquidsoap/doc/orig/images/tabs/tab_docs.png +0 -0
- package/tests/liquidsoap/doc/orig/images/tabs/tab_snippets.png +0 -0
- package/tests/liquidsoap/doc/subst_md.ml +13 -0
- package/tests/liquidsoap/doc/template.html +67 -0
- package/tests/liquidsoap/dune +33 -0
- package/tests/liquidsoap/dune-project +199 -0
- package/tests/liquidsoap/liquidsoap +6 -0
- package/tests/liquidsoap/liquidsoap-core.opam +132 -0
- package/tests/liquidsoap/liquidsoap-js.opam +37 -0
- package/tests/liquidsoap/liquidsoap-lang.opam +35 -0
- package/tests/liquidsoap/liquidsoap-libs-extra.opam +32 -0
- package/tests/liquidsoap/liquidsoap-libs.opam +31 -0
- package/tests/liquidsoap/liquidsoap-mode.opam +40 -0
- package/tests/liquidsoap/liquidsoap-mode.opam.template +9 -0
- package/tests/liquidsoap/liquidsoap.opam +66 -0
- package/tests/liquidsoap/liquidsoap.opam.template +26 -0
- package/tests/liquidsoap/prometheus-liquidsoap.opam +33 -0
- package/tests/liquidsoap/scripts/bash-completion +41 -0
- package/tests/liquidsoap/scripts/dune +29 -0
- package/tests/liquidsoap/scripts/gen_emacs_completion.ml +8 -0
- package/tests/liquidsoap/scripts/liquidsoap-mode.el +88 -0
- package/tests/liquidsoap/scripts/liquidsoap.xml +140 -0
- package/tests/liquidsoap/sdl-liquidsoap.opam +34 -0
- package/tests/liquidsoap/src/bin/dune +24 -0
- package/tests/liquidsoap/src/bin/instruments.plist +1 -0
- package/tests/liquidsoap/src/bin/liquidsoap.ml +1 -0
- package/tests/liquidsoap/src/build/build_tools.ml +3 -0
- package/tests/liquidsoap/src/build/dune +4 -0
- package/tests/liquidsoap/src/config/irc_option.disabled.ml +2 -0
- package/tests/liquidsoap/src/config/liquidsoap_paths.default.ml +25 -0
- package/tests/liquidsoap/src/config/liquidsoap_paths.mli +13 -0
- package/tests/liquidsoap/src/config/liquidsoap_paths.posix.ml +13 -0
- package/tests/liquidsoap/src/config/liquidsoap_paths.standalone.ml +14 -0
- package/tests/liquidsoap/src/config/mem_usage_option.disabled.ml +2 -0
- package/tests/liquidsoap/src/config/noop.disabled.ml +5 -0
- package/tests/liquidsoap/src/config/noop.enabled.ml +2 -0
- package/tests/liquidsoap/src/config/osc_option.disabled.ml +2 -0
- package/tests/liquidsoap/src/config/sdl_option.disabled.ml +2 -0
- package/tests/liquidsoap/src/config/stereotool_option.disabled.ml +2 -0
- package/tests/liquidsoap/src/config/tls_option.disabled.ml +2 -0
- package/tests/liquidsoap/src/console/console.ml +83 -0
- package/tests/liquidsoap/src/console/console.mli +42 -0
- package/tests/liquidsoap/src/console/dune +5 -0
- package/tests/liquidsoap/src/core/alsa_settings.ml +61 -0
- package/tests/liquidsoap/src/core/builtins/builtins_callbacks.ml +53 -0
- package/tests/liquidsoap/src/core/builtins/builtins_clock.ml +129 -0
- package/tests/liquidsoap/src/core/builtins/builtins_cry.ml +123 -0
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_base.ml +27 -0
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_bitstream_filters.ml +336 -0
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_decoder.ml +512 -0
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_encoder.ml +582 -0
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_filters.ml +925 -0
- package/tests/liquidsoap/src/core/builtins/builtins_files.ml +635 -0
- package/tests/liquidsoap/src/core/builtins/builtins_harbor.ml +140 -0
- package/tests/liquidsoap/src/core/builtins/builtins_harbor_ssl.ml +31 -0
- package/tests/liquidsoap/src/core/builtins/builtins_http.ml +231 -0
- package/tests/liquidsoap/src/core/builtins/builtins_irc.ml +112 -0
- package/tests/liquidsoap/src/core/builtins/builtins_jemalloc.ml +136 -0
- package/tests/liquidsoap/src/core/builtins/builtins_lastfm.ml +110 -0
- package/tests/liquidsoap/src/core/builtins/builtins_lo.ml +195 -0
- package/tests/liquidsoap/src/core/builtins/builtins_lo.mli +0 -0
- package/tests/liquidsoap/src/core/builtins/builtins_magic.ml +34 -0
- package/tests/liquidsoap/src/core/builtins/builtins_mem_usage.ml +84 -0
- package/tests/liquidsoap/src/core/builtins/builtins_metadata.ml +39 -0
- package/tests/liquidsoap/src/core/builtins/builtins_optionals.ml +61 -0
- package/tests/liquidsoap/src/core/builtins/builtins_osc.ml +207 -0
- package/tests/liquidsoap/src/core/builtins/builtins_process.ml +333 -0
- package/tests/liquidsoap/src/core/builtins/builtins_prometheus.ml +237 -0
- package/tests/liquidsoap/src/core/builtins/builtins_request.ml +227 -0
- package/tests/liquidsoap/src/core/builtins/builtins_resolvers.ml +186 -0
- package/tests/liquidsoap/src/core/builtins/builtins_runtime.ml +237 -0
- package/tests/liquidsoap/src/core/builtins/builtins_server.ml +69 -0
- package/tests/liquidsoap/src/core/builtins/builtins_settings.ml +343 -0
- package/tests/liquidsoap/src/core/builtins/builtins_socket.ml +577 -0
- package/tests/liquidsoap/src/core/builtins/builtins_source.ml +265 -0
- package/tests/liquidsoap/src/core/builtins/builtins_srt.ml +335 -0
- package/tests/liquidsoap/src/core/builtins/builtins_ssl.ml +234 -0
- package/tests/liquidsoap/src/core/builtins/builtins_string_extra.ml +150 -0
- package/tests/liquidsoap/src/core/builtins/builtins_sys.ml +481 -0
- package/tests/liquidsoap/src/core/builtins/builtins_thread.ml +122 -0
- package/tests/liquidsoap/src/core/builtins/builtins_time.ml +227 -0
- package/tests/liquidsoap/src/core/builtins/builtins_tls.ml +287 -0
- package/tests/liquidsoap/src/core/builtins/builtins_yaml.ml +94 -0
- package/tests/liquidsoap/src/core/clock.ml +586 -0
- package/tests/liquidsoap/src/core/clock.mli +178 -0
- package/tests/liquidsoap/src/core/configure.ml +54 -0
- package/tests/liquidsoap/src/core/configure.mli +43 -0
- package/tests/liquidsoap/src/core/conversions/conversion.ml +67 -0
- package/tests/liquidsoap/src/core/conversions/mean.ml +67 -0
- package/tests/liquidsoap/src/core/conversions/stereo.ml +67 -0
- package/tests/liquidsoap/src/core/conversions/swap.ml +62 -0
- package/tests/liquidsoap/src/core/converters/audio/ffmpeg_audio_converter.ml +44 -0
- package/tests/liquidsoap/src/core/converters/audio/libsamplerate_converter.ml +75 -0
- package/tests/liquidsoap/src/core/converters/audio/native_audio_converter.ml +73 -0
- package/tests/liquidsoap/src/core/converters/audio_converter.ml +168 -0
- package/tests/liquidsoap/src/core/converters/audio_converter.mli +76 -0
- package/tests/liquidsoap/src/core/converters/video/ffmpeg_video_converter.ml +131 -0
- package/tests/liquidsoap/src/core/converters/video/native_video_converter.ml +33 -0
- package/tests/liquidsoap/src/core/converters/video_converter.ml +104 -0
- package/tests/liquidsoap/src/core/converters/video_converter.mli +56 -0
- package/tests/liquidsoap/src/core/decoder/aac_decoder.ml +291 -0
- package/tests/liquidsoap/src/core/decoder/decoder.ml +591 -0
- package/tests/liquidsoap/src/core/decoder/decoder.mli +146 -0
- package/tests/liquidsoap/src/core/decoder/decoder_utils.ml +137 -0
- package/tests/liquidsoap/src/core/decoder/decoder_utils.mli +63 -0
- package/tests/liquidsoap/src/core/decoder/external_decoder.ml +198 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_copy_decoder.ml +82 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_copy_decoder.mli +41 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder.ml +1157 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder_common.ml +102 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_internal_decoder.ml +178 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_internal_decoder.mli +41 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_raw_decoder.ml +76 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_raw_decoder.mli +41 -0
- package/tests/liquidsoap/src/core/decoder/flac_metadata_plug.ml +62 -0
- package/tests/liquidsoap/src/core/decoder/gstreamer_decoder.ml +352 -0
- package/tests/liquidsoap/src/core/decoder/id3_plug.ml +86 -0
- package/tests/liquidsoap/src/core/decoder/image/camlimages_decoder.ml +61 -0
- package/tests/liquidsoap/src/core/decoder/image/ffmpeg_image_decoder.ml +58 -0
- package/tests/liquidsoap/src/core/decoder/image/imagelib_decoder.ml +44 -0
- package/tests/liquidsoap/src/core/decoder/image/ppm_decoder.ml +39 -0
- package/tests/liquidsoap/src/core/decoder/image/sdlimage_decoder.ml +39 -0
- package/tests/liquidsoap/src/core/decoder/image_decoder.ml +181 -0
- package/tests/liquidsoap/src/core/decoder/image_plug.ml +62 -0
- package/tests/liquidsoap/src/core/decoder/liq_flac_decoder.ml +192 -0
- package/tests/liquidsoap/src/core/decoder/liq_ogg_decoder.ml +323 -0
- package/tests/liquidsoap/src/core/decoder/mad_decoder.ml +199 -0
- package/tests/liquidsoap/src/core/decoder/midi_decoder.ml +77 -0
- package/tests/liquidsoap/src/core/decoder/ogg_flac_duration.ml +66 -0
- package/tests/liquidsoap/src/core/decoder/ogg_metadata_plug.ml +62 -0
- package/tests/liquidsoap/src/core/decoder/raw_audio_decoder.ml +162 -0
- package/tests/liquidsoap/src/core/decoder/srt_decoder.ml +92 -0
- package/tests/liquidsoap/src/core/decoder/taglib_plug.ml +102 -0
- package/tests/liquidsoap/src/core/decoder/text/video_text_camlimages.ml +58 -0
- package/tests/liquidsoap/src/core/decoder/text/video_text_gd.ml +63 -0
- package/tests/liquidsoap/src/core/decoder/text/video_text_gstreamer.ml +64 -0
- package/tests/liquidsoap/src/core/decoder/text/video_text_native.ml +47 -0
- package/tests/liquidsoap/src/core/decoder/text/video_text_sdl.ml +62 -0
- package/tests/liquidsoap/src/core/decoder/video_plug.ml +62 -0
- package/tests/liquidsoap/src/core/decoder/vorbisduration.ml +31 -0
- package/tests/liquidsoap/src/core/decoder/wav_aiff_decoder.ml +251 -0
- package/tests/liquidsoap/src/core/doc.ml +1 -0
- package/tests/liquidsoap/src/core/dune +1050 -0
- package/tests/liquidsoap/src/core/encoder/encoder.ml +398 -0
- package/tests/liquidsoap/src/core/encoder/encoder.mli +128 -0
- package/tests/liquidsoap/src/core/encoder/encoder_formats.ml +56 -0
- package/tests/liquidsoap/src/core/encoder/encoders/avi_encoder.ml +126 -0
- package/tests/liquidsoap/src/core/encoder/encoders/external_encoder.ml +177 -0
- package/tests/liquidsoap/src/core/encoder/encoders/fdkaac_encoder.ml +122 -0
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_copy_encoder.ml +196 -0
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder.ml +80 -0
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder_common.ml +342 -0
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_internal_encoder.ml +518 -0
- package/tests/liquidsoap/src/core/encoder/encoders/flac_encoder.ml +79 -0
- package/tests/liquidsoap/src/core/encoder/encoders/gstreamer_encoder.ml +209 -0
- package/tests/liquidsoap/src/core/encoder/encoders/lame_encoder.ml +129 -0
- package/tests/liquidsoap/src/core/encoder/encoders/ogg_encoder.ml +146 -0
- package/tests/liquidsoap/src/core/encoder/encoders/shine_encoder.ml +79 -0
- package/tests/liquidsoap/src/core/encoder/encoders/taglib_id3v2.ml +58 -0
- package/tests/liquidsoap/src/core/encoder/encoders/wav_encoder.ml +83 -0
- package/tests/liquidsoap/src/core/encoder/formats/avi_format.ml +36 -0
- package/tests/liquidsoap/src/core/encoder/formats/external_encoder_format.ml +55 -0
- package/tests/liquidsoap/src/core/encoder/formats/fdkaac_format.ml +92 -0
- package/tests/liquidsoap/src/core/encoder/formats/ffmpeg_format.ml +162 -0
- package/tests/liquidsoap/src/core/encoder/formats/flac_format.ml +34 -0
- package/tests/liquidsoap/src/core/encoder/formats/gstreamer_format.ml +53 -0
- package/tests/liquidsoap/src/core/encoder/formats/mp3_format.ml +88 -0
- package/tests/liquidsoap/src/core/encoder/formats/ogg_format.ml +44 -0
- package/tests/liquidsoap/src/core/encoder/formats/opus_format.ml +95 -0
- package/tests/liquidsoap/src/core/encoder/formats/shine_format.ml +29 -0
- package/tests/liquidsoap/src/core/encoder/formats/speex_format.ml +60 -0
- package/tests/liquidsoap/src/core/encoder/formats/theora_format.ml +66 -0
- package/tests/liquidsoap/src/core/encoder/formats/vorbis_format.ml +52 -0
- package/tests/liquidsoap/src/core/encoder/formats/wav_format.ml +38 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_avi.ml +57 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_external_encoder.ml +120 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_fdkaac.ml +134 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_ffmpeg.ml +544 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_flac.ml +73 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_gstreamer.ml +112 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_mp3.ml +260 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_ogg.ml +69 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_opus.ml +142 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_shine.ml +68 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_speex.ml +96 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_theora.ml +131 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_vorbis.ml +160 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_wav.ml +70 -0
- package/tests/liquidsoap/src/core/encoder/lang_encoder.ml +142 -0
- package/tests/liquidsoap/src/core/error.ml +1 -0
- package/tests/liquidsoap/src/core/file_watcher.inotify.ml +84 -0
- package/tests/liquidsoap/src/core/file_watcher.mtime.ml +90 -0
- package/tests/liquidsoap/src/core/harbor/harbor.ml +1209 -0
- package/tests/liquidsoap/src/core/harbor/harbor_base.ml +72 -0
- package/tests/liquidsoap/src/core/hooks_implementations.ml +172 -0
- package/tests/liquidsoap/src/core/hooks_implementations.mli +1 -0
- package/tests/liquidsoap/src/core/io/alsa_io.ml +358 -0
- package/tests/liquidsoap/src/core/io/ffmpeg_filter_io.ml +345 -0
- package/tests/liquidsoap/src/core/io/ffmpeg_io.ml +612 -0
- package/tests/liquidsoap/src/core/io/gstreamer_io.ml +762 -0
- package/tests/liquidsoap/src/core/io/oss_io.ml +198 -0
- package/tests/liquidsoap/src/core/io/oss_io_c.c +42 -0
- package/tests/liquidsoap/src/core/io/portaudio_io.ml +340 -0
- package/tests/liquidsoap/src/core/io/pulseaudio_io.ml +206 -0
- package/tests/liquidsoap/src/core/io/srt_io.ml +1117 -0
- package/tests/liquidsoap/src/core/io/udp_io.ml +268 -0
- package/tests/liquidsoap/src/core/json.ml +1 -0
- package/tests/liquidsoap/src/core/lang.ml +71 -0
- package/tests/liquidsoap/src/core/lang.mli +344 -0
- package/tests/liquidsoap/src/core/lang_source.ml +586 -0
- package/tests/liquidsoap/src/core/lang_string.ml +1 -0
- package/tests/liquidsoap/src/core/liqmagic.disabled.ml +2 -0
- package/tests/liquidsoap/src/core/liqmagic.enabled.ml +3 -0
- package/tests/liquidsoap/src/core/liqmagic.mli +4 -0
- package/tests/liquidsoap/src/core/modules.ml +39 -0
- package/tests/liquidsoap/src/core/ogg_formats/liq_flac_ogg_decoder.ml +23 -0
- package/tests/liquidsoap/src/core/ogg_formats/liq_opus_decoder.ml +38 -0
- package/tests/liquidsoap/src/core/ogg_formats/liq_speex_decoder.ml +23 -0
- package/tests/liquidsoap/src/core/ogg_formats/liq_theora_decoder.ml +23 -0
- package/tests/liquidsoap/src/core/ogg_formats/liq_vorbis_decoder.ml +23 -0
- package/tests/liquidsoap/src/core/ogg_formats/ogg_flac_encoder.ml +127 -0
- package/tests/liquidsoap/src/core/ogg_formats/ogg_flac_encoder_stubs.c +10 -0
- package/tests/liquidsoap/src/core/ogg_formats/ogg_muxer.ml +413 -0
- package/tests/liquidsoap/src/core/ogg_formats/ogg_muxer.mli +169 -0
- package/tests/liquidsoap/src/core/ogg_formats/opus_encoder.ml +143 -0
- package/tests/liquidsoap/src/core/ogg_formats/speex_encoder.ml +183 -0
- package/tests/liquidsoap/src/core/ogg_formats/theora_encoder.ml +172 -0
- package/tests/liquidsoap/src/core/ogg_formats/vorbis_encoder.ml +125 -0
- package/tests/liquidsoap/src/core/operators/accelerate.ml +115 -0
- package/tests/liquidsoap/src/core/operators/add.ml +461 -0
- package/tests/liquidsoap/src/core/operators/amplify.ml +92 -0
- package/tests/liquidsoap/src/core/operators/available.ml +80 -0
- package/tests/liquidsoap/src/core/operators/biquad_filter.ml +317 -0
- package/tests/liquidsoap/src/core/operators/chord.ml +137 -0
- package/tests/liquidsoap/src/core/operators/clip.ml +57 -0
- package/tests/liquidsoap/src/core/operators/comb.ml +84 -0
- package/tests/liquidsoap/src/core/operators/compand.ml +62 -0
- package/tests/liquidsoap/src/core/operators/compress.ml +270 -0
- package/tests/liquidsoap/src/core/operators/compress_exp.ml +65 -0
- package/tests/liquidsoap/src/core/operators/cross.ml +507 -0
- package/tests/liquidsoap/src/core/operators/cuepoint.ml +217 -0
- package/tests/liquidsoap/src/core/operators/defer.ml +183 -0
- package/tests/liquidsoap/src/core/operators/defer_c.c +23 -0
- package/tests/liquidsoap/src/core/operators/delay.ml +85 -0
- package/tests/liquidsoap/src/core/operators/delay_line.ml +94 -0
- package/tests/liquidsoap/src/core/operators/dtmf.ml +417 -0
- package/tests/liquidsoap/src/core/operators/dyn_op.ml +180 -0
- package/tests/liquidsoap/src/core/operators/echo.ml +96 -0
- package/tests/liquidsoap/src/core/operators/filter.ml +141 -0
- package/tests/liquidsoap/src/core/operators/filter_rc.ml +120 -0
- package/tests/liquidsoap/src/core/operators/fir_filter.ml +185 -0
- package/tests/liquidsoap/src/core/operators/flanger.ml +108 -0
- package/tests/liquidsoap/src/core/operators/frei0r_op.ml +368 -0
- package/tests/liquidsoap/src/core/operators/gate.ml +158 -0
- package/tests/liquidsoap/src/core/operators/iir_filter.ml +607 -0
- package/tests/liquidsoap/src/core/operators/insert_metadata.ml +144 -0
- package/tests/liquidsoap/src/core/operators/ladspa_op.ml +413 -0
- package/tests/liquidsoap/src/core/operators/lilv_op.ml +367 -0
- package/tests/liquidsoap/src/core/operators/lufs.ml +221 -0
- package/tests/liquidsoap/src/core/operators/map_metadata.ml +113 -0
- package/tests/liquidsoap/src/core/operators/map_op.ml +62 -0
- package/tests/liquidsoap/src/core/operators/max_duration.ml +100 -0
- package/tests/liquidsoap/src/core/operators/midi_routing.ml +93 -0
- package/tests/liquidsoap/src/core/operators/ms_stereo.ml +138 -0
- package/tests/liquidsoap/src/core/operators/muxer.ml +279 -0
- package/tests/liquidsoap/src/core/operators/noblank.ml +348 -0
- package/tests/liquidsoap/src/core/operators/normalize.ml +198 -0
- package/tests/liquidsoap/src/core/operators/on_end.ml +83 -0
- package/tests/liquidsoap/src/core/operators/on_frame.ml +105 -0
- package/tests/liquidsoap/src/core/operators/on_metadata.ml +67 -0
- package/tests/liquidsoap/src/core/operators/on_offset.ml +108 -0
- package/tests/liquidsoap/src/core/operators/on_track.ml +72 -0
- package/tests/liquidsoap/src/core/operators/pan.ml +71 -0
- package/tests/liquidsoap/src/core/operators/pipe.ml +349 -0
- package/tests/liquidsoap/src/core/operators/pitch.ml +139 -0
- package/tests/liquidsoap/src/core/operators/replaygain_op.ml +93 -0
- package/tests/liquidsoap/src/core/operators/resample.ml +115 -0
- package/tests/liquidsoap/src/core/operators/rms_smooth.ml +88 -0
- package/tests/liquidsoap/src/core/operators/sequence.ml +154 -0
- package/tests/liquidsoap/src/core/operators/soundtouch_op.ml +119 -0
- package/tests/liquidsoap/src/core/operators/st_bpm.ml +79 -0
- package/tests/liquidsoap/src/core/operators/stereotool_op.ml +196 -0
- package/tests/liquidsoap/src/core/operators/still_frame.ml +93 -0
- package/tests/liquidsoap/src/core/operators/switch.ml +450 -0
- package/tests/liquidsoap/src/core/operators/time_warp.ml +554 -0
- package/tests/liquidsoap/src/core/operators/track/merge_metadata.ml +98 -0
- package/tests/liquidsoap/src/core/operators/track_map.ml +161 -0
- package/tests/liquidsoap/src/core/operators/video_effects.ml +709 -0
- package/tests/liquidsoap/src/core/operators/video_fade.ml +315 -0
- package/tests/liquidsoap/src/core/operators/window_op.ml +158 -0
- package/tests/liquidsoap/src/core/outputs/alsa_out.ml +167 -0
- package/tests/liquidsoap/src/core/outputs/ao_out.ml +167 -0
- package/tests/liquidsoap/src/core/outputs/bjack_out.ml +151 -0
- package/tests/liquidsoap/src/core/outputs/graphics_out.ml +76 -0
- package/tests/liquidsoap/src/core/outputs/harbor_output.ml +632 -0
- package/tests/liquidsoap/src/core/outputs/hls_output.ml +1097 -0
- package/tests/liquidsoap/src/core/outputs/icecast2.ml +641 -0
- package/tests/liquidsoap/src/core/outputs/output.ml +257 -0
- package/tests/liquidsoap/src/core/outputs/output.mli +92 -0
- package/tests/liquidsoap/src/core/outputs/pipe_output.ml +622 -0
- package/tests/liquidsoap/src/core/outputs/sdl_out.ml +131 -0
- package/tests/liquidsoap/src/core/playlist_parser.ml +124 -0
- package/tests/liquidsoap/src/core/playlists/playlist_basic.ml +300 -0
- package/tests/liquidsoap/src/core/playlists/playlist_xml.ml +60 -0
- package/tests/liquidsoap/src/core/plug.ml +1 -0
- package/tests/liquidsoap/src/core/pos.ml +1 -0
- package/tests/liquidsoap/src/core/protocols/annotate.ml +70 -0
- package/tests/liquidsoap/src/core/protocols/mpd.ml +149 -0
- package/tests/liquidsoap/src/core/request.ml +721 -0
- package/tests/liquidsoap/src/core/request.mli +200 -0
- package/tests/liquidsoap/src/core/runtime_error.ml +1 -0
- package/tests/liquidsoap/src/core/shebang.ml +66 -0
- package/tests/liquidsoap/src/core/source.ml +892 -0
- package/tests/liquidsoap/src/core/source.mli +346 -0
- package/tests/liquidsoap/src/core/sources/alsa_in.ml +148 -0
- package/tests/liquidsoap/src/core/sources/audio_gen.ml +106 -0
- package/tests/liquidsoap/src/core/sources/bjack_in.ml +153 -0
- package/tests/liquidsoap/src/core/sources/blank.ml +94 -0
- package/tests/liquidsoap/src/core/sources/debug_sources.ml +60 -0
- package/tests/liquidsoap/src/core/sources/external_input_audio.ml +152 -0
- package/tests/liquidsoap/src/core/sources/external_input_video.ml +246 -0
- package/tests/liquidsoap/src/core/sources/generated.ml +137 -0
- package/tests/liquidsoap/src/core/sources/harbor_input.ml +489 -0
- package/tests/liquidsoap/src/core/sources/latest_metadata.ml +38 -0
- package/tests/liquidsoap/src/core/sources/noise.ml +79 -0
- package/tests/liquidsoap/src/core/sources/request_simple.ml +278 -0
- package/tests/liquidsoap/src/core/sources/request_source.ml +542 -0
- package/tests/liquidsoap/src/core/sources/request_source.mli +112 -0
- package/tests/liquidsoap/src/core/sources/synthesized.ml +62 -0
- package/tests/liquidsoap/src/core/sources/video_board.ml +196 -0
- package/tests/liquidsoap/src/core/sources/video_testsrc.ml +88 -0
- package/tests/liquidsoap/src/core/sources/video_text.ml +127 -0
- package/tests/liquidsoap/src/core/startup.ml +7 -0
- package/tests/liquidsoap/src/core/stream/aFrame.ml +66 -0
- package/tests/liquidsoap/src/core/stream/aFrame.mli +77 -0
- package/tests/liquidsoap/src/core/stream/content.ml +51 -0
- package/tests/liquidsoap/src/core/stream/content.mli +212 -0
- package/tests/liquidsoap/src/core/stream/content_audio.ml +107 -0
- package/tests/liquidsoap/src/core/stream/content_base.ml +449 -0
- package/tests/liquidsoap/src/core/stream/content_midi.ml +67 -0
- package/tests/liquidsoap/src/core/stream/content_pcm_base.ml +78 -0
- package/tests/liquidsoap/src/core/stream/content_pcm_f32.ml +52 -0
- package/tests/liquidsoap/src/core/stream/content_pcm_f32.mli +35 -0
- package/tests/liquidsoap/src/core/stream/content_pcm_s16.ml +52 -0
- package/tests/liquidsoap/src/core/stream/content_pcm_s16.mli +36 -0
- package/tests/liquidsoap/src/core/stream/content_timed.ml +149 -0
- package/tests/liquidsoap/src/core/stream/content_video.ml +119 -0
- package/tests/liquidsoap/src/core/stream/ffmpeg_content_base.ml +81 -0
- package/tests/liquidsoap/src/core/stream/ffmpeg_copy_content.ml +157 -0
- package/tests/liquidsoap/src/core/stream/ffmpeg_raw_content.ml +261 -0
- package/tests/liquidsoap/src/core/stream/frame.ml +197 -0
- package/tests/liquidsoap/src/core/stream/frame.mli +243 -0
- package/tests/liquidsoap/src/core/stream/frame_base.ml +145 -0
- package/tests/liquidsoap/src/core/stream/frame_settings.ml +249 -0
- package/tests/liquidsoap/src/core/stream/generator.ml +303 -0
- package/tests/liquidsoap/src/core/stream/generator.mli +106 -0
- package/tests/liquidsoap/src/core/stream/mFrame.ml +45 -0
- package/tests/liquidsoap/src/core/stream/mFrame.mli +29 -0
- package/tests/liquidsoap/src/core/stream/vFrame.ml +52 -0
- package/tests/liquidsoap/src/core/stream/vFrame.mli +65 -0
- package/tests/liquidsoap/src/core/synth/dssi_op.ml +249 -0
- package/tests/liquidsoap/src/core/synth/keyboard.ml +142 -0
- package/tests/liquidsoap/src/core/synth/keyboard_sdl.ml +174 -0
- package/tests/liquidsoap/src/core/synth/synth_op.ml +186 -0
- package/tests/liquidsoap/src/core/term.ml +1 -0
- package/tests/liquidsoap/src/core/tools/avi.ml +380 -0
- package/tests/liquidsoap/src/core/tools/charset.ml +52 -0
- package/tests/liquidsoap/src/core/tools/charset.mli +49 -0
- package/tests/liquidsoap/src/core/tools/charset_base.ml +63 -0
- package/tests/liquidsoap/src/core/tools/child_support.ml +105 -0
- package/tests/liquidsoap/src/core/tools/external_input.ml +78 -0
- package/tests/liquidsoap/src/core/tools/extra_args.ml +27 -0
- package/tests/liquidsoap/src/core/tools/extra_args.mli +26 -0
- package/tests/liquidsoap/src/core/tools/extralib.ml +1 -0
- package/tests/liquidsoap/src/core/tools/ffmpeg_avfilter_utils.ml +151 -0
- package/tests/liquidsoap/src/core/tools/ffmpeg_avfilter_utils.mli +44 -0
- package/tests/liquidsoap/src/core/tools/ffmpeg_utils.ml +354 -0
- package/tests/liquidsoap/src/core/tools/ffmpeg_utils.mli +79 -0
- package/tests/liquidsoap/src/core/tools/gstreamer_utils.ml +200 -0
- package/tests/liquidsoap/src/core/tools/http.ml +173 -0
- package/tests/liquidsoap/src/core/tools/http.mli +62 -0
- package/tests/liquidsoap/src/core/tools/https.mli +1 -0
- package/tests/liquidsoap/src/core/tools/icecast_utils.ml +202 -0
- package/tests/liquidsoap/src/core/tools/ioRing.ml +233 -0
- package/tests/liquidsoap/src/core/tools/lifecycle.ml +100 -0
- package/tests/liquidsoap/src/core/tools/lifecycle.mli +88 -0
- package/tests/liquidsoap/src/core/tools/liq_posix_time.ml +58 -0
- package/tests/liquidsoap/src/core/tools/liq_prometheus.ml +56 -0
- package/tests/liquidsoap/src/core/tools/liq_time.ml +40 -0
- package/tests/liquidsoap/src/core/tools/liq_time.mli +19 -0
- package/tests/liquidsoap/src/core/tools/liqcurl.ml +221 -0
- package/tests/liquidsoap/src/core/tools/liqfm.ml +241 -0
- package/tests/liquidsoap/src/core/tools/liqfm.mli +40 -0
- package/tests/liquidsoap/src/core/tools/liqmemtrace.ml +25 -0
- package/tests/liquidsoap/src/core/tools/log.ml +147 -0
- package/tests/liquidsoap/src/core/tools/log.mli +12 -0
- package/tests/liquidsoap/src/core/tools/pool.ml +87 -0
- package/tests/liquidsoap/src/core/tools/process_handler.ml +345 -0
- package/tests/liquidsoap/src/core/tools/process_handler.mli +113 -0
- package/tests/liquidsoap/src/core/tools/producer_consumer.ml +139 -0
- package/tests/liquidsoap/src/core/tools/rqueue.ml +151 -0
- package/tests/liquidsoap/src/core/tools/rqueue.mli +59 -0
- package/tests/liquidsoap/src/core/tools/sandbox.ml +177 -0
- package/tests/liquidsoap/src/core/tools/sandbox.mli +28 -0
- package/tests/liquidsoap/src/core/tools/sdl_log_level.ml +29 -0
- package/tests/liquidsoap/src/core/tools/sdl_utils.ml +222 -0
- package/tests/liquidsoap/src/core/tools/server.ml +468 -0
- package/tests/liquidsoap/src/core/tools/server.mli +99 -0
- package/tests/liquidsoap/src/core/tools/server_builtins.ml +63 -0
- package/tests/liquidsoap/src/core/tools/sha1.ml +139 -0
- package/tests/liquidsoap/src/core/tools/srt_parser.ml +100 -0
- package/tests/liquidsoap/src/core/tools/ssl_base.ml +25 -0
- package/tests/liquidsoap/src/core/tools/start_stop.ml +182 -0
- package/tests/liquidsoap/src/core/tools/stringView.ml +36 -0
- package/tests/liquidsoap/src/core/tools/stringView.mli +50 -0
- package/tests/liquidsoap/src/core/tools/strings.ml +243 -0
- package/tests/liquidsoap/src/core/tools/strings.mli +209 -0
- package/tests/liquidsoap/src/core/tools/tutils.ml +393 -0
- package/tests/liquidsoap/src/core/tools/tutils.mli +93 -0
- package/tests/liquidsoap/src/core/tools/unix_c.c +86 -0
- package/tests/liquidsoap/src/core/tools/utils.ml +622 -0
- package/tests/liquidsoap/src/core/tools/wav_aiff.ml +261 -0
- package/tests/liquidsoap/src/core/tools/wav_aiff.mli +84 -0
- package/tests/liquidsoap/src/core/tools/websocket.ml +290 -0
- package/tests/liquidsoap/src/core/track.ml +38 -0
- package/tests/liquidsoap/src/core/track.mli +27 -0
- package/tests/liquidsoap/src/core/type.ml +1 -0
- package/tests/liquidsoap/src/core/types/format_type.ml +343 -0
- package/tests/liquidsoap/src/core/types/format_type.mli +45 -0
- package/tests/liquidsoap/src/core/types/frame_type.ml +134 -0
- package/tests/liquidsoap/src/core/types/frame_type.mli +52 -0
- package/tests/liquidsoap/src/core/typing.ml +1 -0
- package/tests/liquidsoap/src/core/unifier.ml +1 -0
- package/tests/liquidsoap/src/core/value.ml +1 -0
- package/tests/liquidsoap/src/core/visualization/midimeter.ml +68 -0
- package/tests/liquidsoap/src/core/visualization/video_volume.ml +153 -0
- package/tests/liquidsoap/src/core/visualization/vis_volume.ml +131 -0
- package/tests/liquidsoap/src/js/dune +45 -0
- package/tests/liquidsoap/src/js/index.html +162 -0
- package/tests/liquidsoap/src/js/init_js.ml +6 -0
- package/tests/liquidsoap/src/js/interactive_js.ml +88 -0
- package/tests/liquidsoap/src/js/regexp_js.ml +57 -0
- package/tests/liquidsoap/src/js/regexp_js.mli +4 -0
- package/tests/liquidsoap/src/js/stdlib_js.liq +9 -0
- package/tests/liquidsoap/src/lang/build_config.mli +11 -0
- package/tests/liquidsoap/src/lang/builtins_bool.ml +74 -0
- package/tests/liquidsoap/src/lang/builtins_eval.ml +37 -0
- package/tests/liquidsoap/src/lang/builtins_getter.ml +109 -0
- package/tests/liquidsoap/src/lang/builtins_json.ml +442 -0
- package/tests/liquidsoap/src/lang/builtins_lang.ml +241 -0
- package/tests/liquidsoap/src/lang/builtins_list.ml +268 -0
- package/tests/liquidsoap/src/lang/builtins_math.ml +300 -0
- package/tests/liquidsoap/src/lang/builtins_null.ml +72 -0
- package/tests/liquidsoap/src/lang/builtins_profiler.ml +56 -0
- package/tests/liquidsoap/src/lang/builtins_ref.ml +33 -0
- package/tests/liquidsoap/src/lang/builtins_regexp.ml +247 -0
- package/tests/liquidsoap/src/lang/builtins_string.ml +563 -0
- package/tests/liquidsoap/src/lang/builtins_yaml.ml +51 -0
- package/tests/liquidsoap/src/lang/doc.ml +696 -0
- package/tests/liquidsoap/src/lang/dune +144 -0
- package/tests/liquidsoap/src/lang/environment.ml +125 -0
- package/tests/liquidsoap/src/lang/environment.mli +49 -0
- package/tests/liquidsoap/src/lang/error.ml +45 -0
- package/tests/liquidsoap/src/lang/error.mli +27 -0
- package/tests/liquidsoap/src/lang/evaluation.ml +537 -0
- package/tests/liquidsoap/src/lang/evaluation.mli +30 -0
- package/tests/liquidsoap/src/lang/extralib.ml +90 -0
- package/tests/liquidsoap/src/lang/hooks.ml +58 -0
- package/tests/liquidsoap/src/lang/hooks.mli +38 -0
- package/tests/liquidsoap/src/lang/json.ml +142 -0
- package/tests/liquidsoap/src/lang/json.mli +18 -0
- package/tests/liquidsoap/src/lang/json_base.ml +12 -0
- package/tests/liquidsoap/src/lang/json_lexer.ml +322 -0
- package/tests/liquidsoap/src/lang/json_parser.mly +101 -0
- package/tests/liquidsoap/src/lang/lang.ml +3 -0
- package/tests/liquidsoap/src/lang/lang.mli +255 -0
- package/tests/liquidsoap/src/lang/lang_core.ml +493 -0
- package/tests/liquidsoap/src/lang/lang_error.ml +165 -0
- package/tests/liquidsoap/src/lang/lang_regexp.ml +24 -0
- package/tests/liquidsoap/src/lang/lang_string.ml +563 -0
- package/tests/liquidsoap/src/lang/lang_string.mli +80 -0
- package/tests/liquidsoap/src/lang/lexer.ml +520 -0
- package/tests/liquidsoap/src/lang/methods.ml +43 -0
- package/tests/liquidsoap/src/lang/methods.mli +43 -0
- package/tests/liquidsoap/src/lang/modules.ml +33 -0
- package/tests/liquidsoap/src/lang/parser.mly +690 -0
- package/tests/liquidsoap/src/lang/parser_helper.ml +202 -0
- package/tests/liquidsoap/src/lang/parser_helper.mli +77 -0
- package/tests/liquidsoap/src/lang/plug.ml +99 -0
- package/tests/liquidsoap/src/lang/pos.ml +73 -0
- package/tests/liquidsoap/src/lang/preprocessor.ml +197 -0
- package/tests/liquidsoap/src/lang/profiler.ml +92 -0
- package/tests/liquidsoap/src/lang/regexp.ml +39 -0
- package/tests/liquidsoap/src/lang/regexp.mli +26 -0
- package/tests/liquidsoap/src/lang/repr.ml +537 -0
- package/tests/liquidsoap/src/lang/runtime.ml +360 -0
- package/tests/liquidsoap/src/lang/runtime.mli +70 -0
- package/tests/liquidsoap/src/lang/runtime_error.ml +49 -0
- package/tests/liquidsoap/src/lang/runtime_error.mli +37 -0
- package/tests/liquidsoap/src/lang/startup.ml +34 -0
- package/tests/liquidsoap/src/lang/term/parsed_term.ml +329 -0
- package/tests/liquidsoap/src/lang/term/runtime_term.ml +75 -0
- package/tests/liquidsoap/src/lang/term/term_base.ml +554 -0
- package/tests/liquidsoap/src/lang/term/term_reducer.ml +891 -0
- package/tests/liquidsoap/src/lang/term/term_reducer.mli +33 -0
- package/tests/liquidsoap/src/lang/term.ml +48 -0
- package/tests/liquidsoap/src/lang/term.mli +109 -0
- package/tests/liquidsoap/src/lang/type.ml +65 -0
- package/tests/liquidsoap/src/lang/type.mli +146 -0
- package/tests/liquidsoap/src/lang/typechecking.ml +439 -0
- package/tests/liquidsoap/src/lang/typechecking.mli +14 -0
- package/tests/liquidsoap/src/lang/types/ground_type.ml +106 -0
- package/tests/liquidsoap/src/lang/types/ground_type.mli +54 -0
- package/tests/liquidsoap/src/lang/types/ref_type.ml +28 -0
- package/tests/liquidsoap/src/lang/types/type_base.ml +382 -0
- package/tests/liquidsoap/src/lang/typing.ml +649 -0
- package/tests/liquidsoap/src/lang/typing.mli +60 -0
- package/tests/liquidsoap/src/lang/unifier.ml +44 -0
- package/tests/liquidsoap/src/lang/unifier.mli +28 -0
- package/tests/liquidsoap/src/lang/utils.ml +51 -0
- package/tests/liquidsoap/src/lang/value.ml +227 -0
- package/tests/liquidsoap/src/libs/audio.liq +342 -0
- package/tests/liquidsoap/src/libs/clock.liq +63 -0
- package/tests/liquidsoap/src/libs/dune +15 -0
- package/tests/liquidsoap/src/libs/error.liq +34 -0
- package/tests/liquidsoap/src/libs/extra/audio.liq +617 -0
- package/tests/liquidsoap/src/libs/extra/deprecations.liq +892 -0
- package/tests/liquidsoap/src/libs/extra/externals.liq +802 -0
- package/tests/liquidsoap/src/libs/extra/file.liq +66 -0
- package/tests/liquidsoap/src/libs/extra/gstreamer.liq +209 -0
- package/tests/liquidsoap/src/libs/extra/http.liq +159 -0
- package/tests/liquidsoap/src/libs/extra/interactive.liq +854 -0
- package/tests/liquidsoap/src/libs/extra/lastfm.liq +185 -0
- package/tests/liquidsoap/src/libs/extra/native.liq +195 -0
- package/tests/liquidsoap/src/libs/extra/server.liq +175 -0
- package/tests/liquidsoap/src/libs/extra/source.liq +260 -0
- package/tests/liquidsoap/src/libs/extra/telnet.liq +281 -0
- package/tests/liquidsoap/src/libs/extra/visualization.liq +68 -0
- package/tests/liquidsoap/src/libs/fades.liq +651 -0
- package/tests/liquidsoap/src/libs/ffmpeg.liq +590 -0
- package/tests/liquidsoap/src/libs/file.liq +269 -0
- package/tests/liquidsoap/src/libs/getter.liq +74 -0
- package/tests/liquidsoap/src/libs/hls.liq +327 -0
- package/tests/liquidsoap/src/libs/http.liq +990 -0
- package/tests/liquidsoap/src/libs/http_codes.liq +449 -0
- package/tests/liquidsoap/src/libs/icecast.liq +55 -0
- package/tests/liquidsoap/src/libs/io.liq +169 -0
- package/tests/liquidsoap/src/libs/liquidsoap.liq +31 -0
- package/tests/liquidsoap/src/libs/log.liq +47 -0
- package/tests/liquidsoap/src/libs/math.liq +23 -0
- package/tests/liquidsoap/src/libs/medialib.liq +382 -0
- package/tests/liquidsoap/src/libs/metadata.liq +259 -0
- package/tests/liquidsoap/src/libs/null.liq +73 -0
- package/tests/liquidsoap/src/libs/playlist.liq +634 -0
- package/tests/liquidsoap/src/libs/predicate.liq +106 -0
- package/tests/liquidsoap/src/libs/process.liq +93 -0
- package/tests/liquidsoap/src/libs/profiler.liq +5 -0
- package/tests/liquidsoap/src/libs/protocols.liq +1043 -0
- package/tests/liquidsoap/src/libs/ref.liq +28 -0
- package/tests/liquidsoap/src/libs/replaygain.liq +118 -0
- package/tests/liquidsoap/src/libs/request.liq +236 -0
- package/tests/liquidsoap/src/libs/resolvers.liq +30 -0
- package/tests/liquidsoap/src/libs/runtime.liq +78 -0
- package/tests/liquidsoap/src/libs/server.liq +7 -0
- package/tests/liquidsoap/src/libs/settings.liq +27 -0
- package/tests/liquidsoap/src/libs/socket.liq +28 -0
- package/tests/liquidsoap/src/libs/source.liq +257 -0
- package/tests/liquidsoap/src/libs/stdlib.liq +105 -0
- package/tests/liquidsoap/src/libs/string.liq +409 -0
- package/tests/liquidsoap/src/libs/switches.liq +240 -0
- package/tests/liquidsoap/src/libs/testing.liq +37 -0
- package/tests/liquidsoap/src/libs/thread.liq +64 -0
- package/tests/liquidsoap/src/libs/tracks.liq +63 -0
- package/tests/liquidsoap/src/libs/utils.liq +67 -0
- package/tests/liquidsoap/src/libs/video.liq +763 -0
- package/tests/liquidsoap/src/runtime/build_config.ml +143 -0
- package/tests/liquidsoap/src/runtime/dune +14 -0
- package/tests/liquidsoap/src/runtime/main.ml +730 -0
- package/tests/liquidsoap/src/runtime/runner.default.ml +25 -0
- package/tests/liquidsoap/src/runtime/runner.mli +1 -0
- package/tests/liquidsoap/src/runtime/runner.winsvc.ml +83 -0
- package/tests/liquidsoap/src/stereotool/dune +5 -0
- package/tests/liquidsoap/src/stereotool/stereotool.ml +151 -0
- package/tests/liquidsoap/src/stereotool/stereotool.mli +30 -0
- package/tests/liquidsoap/src/tooling/dune +13 -0
- package/tests/liquidsoap/src/tooling/parsed_json.ml +595 -0
- package/tests/liquidsoap/src/tooling/parsed_json.mli +26 -0
- package/tests/liquidsoap/tests/check_output.ml +41 -0
- package/tests/liquidsoap/tests/core/content_test.ml +80 -0
- package/tests/liquidsoap/tests/core/decoder_test.ml +55 -0
- package/tests/liquidsoap/tests/core/dune +57 -0
- package/tests/liquidsoap/tests/core/dune.inc +363 -0
- package/tests/liquidsoap/tests/core/ffmpeg_quality.ml +81 -0
- package/tests/liquidsoap/tests/core/frame_test.ml +41 -0
- package/tests/liquidsoap/tests/core/gen_dune.ml +52 -0
- package/tests/liquidsoap/tests/core/generator_test.ml +106 -0
- package/tests/liquidsoap/tests/core/is_url.ml +4 -0
- package/tests/liquidsoap/tests/core/json_test.ml +129 -0
- package/tests/liquidsoap/tests/core/meth.ml +48 -0
- package/tests/liquidsoap/tests/core/more_types.ml +63 -0
- package/tests/liquidsoap/tests/core/output_encoded_test.ml +42 -0
- package/tests/liquidsoap/tests/core/output_test.ml +42 -0
- package/tests/liquidsoap/tests/core/parsesrt.ml +12 -0
- package/tests/liquidsoap/tests/core/playlist_basic_test.ml +74 -0
- package/tests/liquidsoap/tests/core/pool_test.ml +46 -0
- package/tests/liquidsoap/tests/core/readavi.ml +8 -0
- package/tests/liquidsoap/tests/core/source_test.ml +16 -0
- package/tests/liquidsoap/tests/core/start_stop_test.ml +30 -0
- package/tests/liquidsoap/tests/core/stream_decoder_test.ml +52 -0
- package/tests/liquidsoap/tests/core/string_test.ml +1 -0
- package/tests/liquidsoap/tests/core/strings_test.ml +15 -0
- package/tests/liquidsoap/tests/core/taglib_test.ml +35 -0
- package/tests/liquidsoap/tests/core/test.srt +20 -0
- package/tests/liquidsoap/tests/core/timezone.ml +7 -0
- package/tests/liquidsoap/tests/core/types.ml +397 -0
- package/tests/liquidsoap/tests/core/unifier_test.ml +29 -0
- package/tests/liquidsoap/tests/core/utils_test.ml +6 -0
- package/tests/liquidsoap/tests/core/version_test.ml +27 -0
- package/tests/liquidsoap/tests/dune +14 -0
- package/tests/liquidsoap/tests/failures/ctype.liq +9 -0
- package/tests/liquidsoap/tests/failures/error.liq +7 -0
- package/tests/liquidsoap/tests/failures/record-invalid-member1.liq +10 -0
- package/tests/liquidsoap/tests/failures/record-invalid-member2.liq +3 -0
- package/tests/liquidsoap/tests/failures/ref.liq +12 -0
- package/tests/liquidsoap/tests/fixme/GH1170.liq +37 -0
- package/tests/liquidsoap/tests/fixme/LS527.liq +26 -0
- package/tests/liquidsoap/tests/fixme/cross2.liq +20 -0
- package/tests/liquidsoap/tests/fixme/cross3.liq +26 -0
- package/tests/liquidsoap/tests/fixme/sequence-1.liq +41 -0
- package/tests/liquidsoap/tests/fixme/sequence-2.liq +36 -0
- package/tests/liquidsoap/tests/gen_dune.ml +46 -0
- package/tests/liquidsoap/tests/harbor/dune +18 -0
- package/tests/liquidsoap/tests/harbor/dune.inc +60 -0
- package/tests/liquidsoap/tests/harbor/http.liq +314 -0
- package/tests/liquidsoap/tests/harbor/http2.liq +105 -0
- package/tests/liquidsoap/tests/harbor/http3.liq +56 -0
- package/tests/liquidsoap/tests/harbor/post.liq +207 -0
- package/tests/liquidsoap/tests/harbor/put.liq +209 -0
- package/tests/liquidsoap/tests/language/argsof.liq +48 -0
- package/tests/liquidsoap/tests/language/bool.liq +39 -0
- package/tests/liquidsoap/tests/language/comments.liq +76 -0
- package/tests/liquidsoap/tests/language/conversions.liq +14 -0
- package/tests/liquidsoap/tests/language/doc.liq +14 -0
- package/tests/liquidsoap/tests/language/dune +74 -0
- package/tests/liquidsoap/tests/language/dune.inc +504 -0
- package/tests/liquidsoap/tests/language/encoders.liq +93 -0
- package/tests/liquidsoap/tests/language/error.liq +164 -0
- package/tests/liquidsoap/tests/language/eval.liq +73 -0
- package/tests/liquidsoap/tests/language/file.liq +36 -0
- package/tests/liquidsoap/tests/language/file.watch.liq +19 -0
- package/tests/liquidsoap/tests/language/file.watch2.liq +23 -0
- package/tests/liquidsoap/tests/language/file_protocol.liq +32 -0
- package/tests/liquidsoap/tests/language/functions.liq +52 -0
- package/tests/liquidsoap/tests/language/gen_dune.ml +49 -0
- package/tests/liquidsoap/tests/language/getter.liq +77 -0
- package/tests/liquidsoap/tests/language/interactive.liq +50 -0
- package/tests/liquidsoap/tests/language/json.liq +311 -0
- package/tests/liquidsoap/tests/language/list.liq +124 -0
- package/tests/liquidsoap/tests/language/loop.liq +30 -0
- package/tests/liquidsoap/tests/language/math.liq +12 -0
- package/tests/liquidsoap/tests/language/mem_usage.liq +68 -0
- package/tests/liquidsoap/tests/language/metadata.liq +136 -0
- package/tests/liquidsoap/tests/language/metrics.liq +22 -0
- package/tests/liquidsoap/tests/language/null.liq +42 -0
- package/tests/liquidsoap/tests/language/number.liq +54 -0
- package/tests/liquidsoap/tests/language/osc.liq +69 -0
- package/tests/liquidsoap/tests/language/pattern.liq +103 -0
- package/tests/liquidsoap/tests/language/pp.liq +57 -0
- package/tests/liquidsoap/tests/language/predicate.liq +54 -0
- package/tests/liquidsoap/tests/language/process.liq +51 -0
- package/tests/liquidsoap/tests/language/rec.liq +26 -0
- package/tests/liquidsoap/tests/language/record.liq +277 -0
- package/tests/liquidsoap/tests/language/ref.liq +37 -0
- package/tests/liquidsoap/tests/language/regexp.liq +41 -0
- package/tests/liquidsoap/tests/language/socket.liq +45 -0
- package/tests/liquidsoap/tests/language/stdlib.liq +24 -0
- package/tests/liquidsoap/tests/language/string.liq +170 -0
- package/tests/liquidsoap/tests/language/test_cover.liq +8 -0
- package/tests/liquidsoap/tests/language/thread.liq +70 -0
- package/tests/liquidsoap/tests/language/time.liq +25 -0
- package/tests/liquidsoap/tests/language/type_errors.liq +399 -0
- package/tests/liquidsoap/tests/language/typing.liq +233 -0
- package/tests/liquidsoap/tests/language/url.liq +15 -0
- package/tests/liquidsoap/tests/language/write_cover.liq +9 -0
- package/tests/liquidsoap/tests/language/yaml.liq +36 -0
- package/tests/liquidsoap/tests/media/dune +253 -0
- package/tests/liquidsoap/tests/media/dune.inc +1805 -0
- package/tests/liquidsoap/tests/media/encoder_audio_only.liq.in +14 -0
- package/tests/liquidsoap/tests/media/encoder_audio_video.liq.in +16 -0
- package/tests/liquidsoap/tests/media/encoder_multitrack.liq.in +19 -0
- package/tests/liquidsoap/tests/media/encoder_video_only.liq.in +14 -0
- package/tests/liquidsoap/tests/media/ffmpeg_add_text.liq +88 -0
- package/tests/liquidsoap/tests/media/ffmpeg_audio_decoder.liq +45 -0
- package/tests/liquidsoap/tests/media/ffmpeg_complex_filter.liq +59 -0
- package/tests/liquidsoap/tests/media/ffmpeg_copy_and_encode_decoder.liq +76 -0
- package/tests/liquidsoap/tests/media/ffmpeg_copy_concat.liq +39 -0
- package/tests/liquidsoap/tests/media/ffmpeg_copy_decoder.liq +90 -0
- package/tests/liquidsoap/tests/media/ffmpeg_distributed_hls.liq +125 -0
- package/tests/liquidsoap/tests/media/ffmpeg_distributed_hls_state.json +112 -0
- package/tests/liquidsoap/tests/media/ffmpeg_drop_tracks.liq +119 -0
- package/tests/liquidsoap/tests/media/ffmpeg_filter.liq +105 -0
- package/tests/liquidsoap/tests/media/ffmpeg_filter_changing_rate.liq +117 -0
- package/tests/liquidsoap/tests/media/ffmpeg_inline_encode_decode.liq +103 -0
- package/tests/liquidsoap/tests/media/ffmpeg_inline_encode_decode_audio.liq +77 -0
- package/tests/liquidsoap/tests/media/ffmpeg_inline_encode_decode_video.liq +66 -0
- package/tests/liquidsoap/tests/media/ffmpeg_raw_and_copy_decoder.liq +92 -0
- package/tests/liquidsoap/tests/media/ffmpeg_raw_and_encode_decoder.liq +78 -0
- package/tests/liquidsoap/tests/media/ffmpeg_raw_decoder.liq +80 -0
- package/tests/liquidsoap/tests/media/ffmpeg_raw_hls.liq +115 -0
- package/tests/liquidsoap/tests/media/ffmpeg_transparency_filter.liq +91 -0
- package/tests/liquidsoap/tests/media/ffmpeg_video_decoder.liq +52 -0
- package/tests/liquidsoap/tests/media/gen_dune.ml +192 -0
- package/tests/liquidsoap/tests/media/mk_encoder_test.sh +8 -0
- package/tests/liquidsoap/tests/media/mk_stream_test.sh +11 -0
- package/tests/liquidsoap/tests/media/mono.liq +45 -0
- package/tests/liquidsoap/tests/media/multitrack.liq +113 -0
- package/tests/liquidsoap/tests/media/pcm_f32_decode.liq +4 -0
- package/tests/liquidsoap/tests/media/pcm_s16_decode.liq +4 -0
- package/tests/liquidsoap/tests/media/stereo.liq +45 -0
- package/tests/liquidsoap/tests/media/stream_audio.liq.in +49 -0
- package/tests/liquidsoap/tests/media/stream_video.liq.in +49 -0
- package/tests/liquidsoap/tests/media/taglib.liq +11 -0
- package/tests/liquidsoap/tests/media/video_size.liq +54 -0
- package/tests/liquidsoap/tests/performance/dune +31 -0
- package/tests/liquidsoap/tests/performance/erathostenes.liq +27 -0
- package/tests/liquidsoap/tests/performance/gen_bigrecord.ml +69 -0
- package/tests/liquidsoap/tests/performance/memory.liq +6 -0
- package/tests/liquidsoap/tests/performance/performance.liq +12 -0
- package/tests/liquidsoap/tests/performance/small-record.liq +43 -0
- package/tests/liquidsoap/tests/regression/115-1.liq +11 -0
- package/tests/liquidsoap/tests/regression/115-2.liq +6 -0
- package/tests/liquidsoap/tests/regression/AC5109.liq +26 -0
- package/tests/liquidsoap/tests/regression/BUG403.liq +29 -0
- package/tests/liquidsoap/tests/regression/GH-action-919422659.liq +17 -0
- package/tests/liquidsoap/tests/regression/GH1129.liq +57 -0
- package/tests/liquidsoap/tests/regression/GH1146.liq +15 -0
- package/tests/liquidsoap/tests/regression/GH1151.liq +16 -0
- package/tests/liquidsoap/tests/regression/GH1159.liq +13 -0
- package/tests/liquidsoap/tests/regression/GH1279.liq +44 -0
- package/tests/liquidsoap/tests/regression/GH1327.liq +61 -0
- package/tests/liquidsoap/tests/regression/GH2573.output +7 -0
- package/tests/liquidsoap/tests/regression/GH2585.liq +29 -0
- package/tests/liquidsoap/tests/regression/GH2602.liq +18 -0
- package/tests/liquidsoap/tests/regression/GH2756-2.liq +81 -0
- package/tests/liquidsoap/tests/regression/GH2756.liq +90 -0
- package/tests/liquidsoap/tests/regression/GH2758.liq +11 -0
- package/tests/liquidsoap/tests/regression/GH2842.liq +26 -0
- package/tests/liquidsoap/tests/regression/GH2850.liq +74 -0
- package/tests/liquidsoap/tests/regression/GH2867.liq +6 -0
- package/tests/liquidsoap/tests/regression/GH2871.liq +21 -0
- package/tests/liquidsoap/tests/regression/GH2872.liq +21 -0
- package/tests/liquidsoap/tests/regression/GH2897.liq +24 -0
- package/tests/liquidsoap/tests/regression/GH2902.liq +39 -0
- package/tests/liquidsoap/tests/regression/GH2926.liq +17 -0
- package/tests/liquidsoap/tests/regression/GH3093.liq +10 -0
- package/tests/liquidsoap/tests/regression/GH3121.liq +16 -0
- package/tests/liquidsoap/tests/regression/GH3132.liq +11 -0
- package/tests/liquidsoap/tests/regression/GH3224.liq +6 -0
- package/tests/liquidsoap/tests/regression/GH3239-2.liq +17 -0
- package/tests/liquidsoap/tests/regression/GH3239.liq +16 -0
- package/tests/liquidsoap/tests/regression/GH3276.liq +23 -0
- package/tests/liquidsoap/tests/regression/GH3316.liq +37 -0
- package/tests/liquidsoap/tests/regression/LS268.liq +9 -0
- package/tests/liquidsoap/tests/regression/LS354-1.liq +7 -0
- package/tests/liquidsoap/tests/regression/LS354-2.liq +15 -0
- package/tests/liquidsoap/tests/regression/LS460.liq +16 -0
- package/tests/liquidsoap/tests/regression/LS503.liq +20 -0
- package/tests/liquidsoap/tests/regression/default_format.liq +3 -0
- package/tests/liquidsoap/tests/regression/dune +39 -0
- package/tests/liquidsoap/tests/regression/dune.inc +685 -0
- package/tests/liquidsoap/tests/regression/external-encoder.liq +6 -0
- package/tests/liquidsoap/tests/regression/ffmpeg-copy-encode.liq +31 -0
- package/tests/liquidsoap/tests/regression/ffmpeg-copy-input-http.liq +8 -0
- package/tests/liquidsoap/tests/regression/ffmpeg-naming-convention.liq +66 -0
- package/tests/liquidsoap/tests/regression/gen_dune.ml +47 -0
- package/tests/liquidsoap/tests/regression/infallible-shutdown.liq +5 -0
- package/tests/liquidsoap/tests/regression/init-error.liq +9 -0
- package/tests/liquidsoap/tests/regression/initial_request_queue.liq +8 -0
- package/tests/liquidsoap/tests/regression/input_rtmp.liq +3 -0
- package/tests/liquidsoap/tests/regression/metadata_cache.liq +39 -0
- package/tests/liquidsoap/tests/regression/playlist-id.liq +21 -0
- package/tests/liquidsoap/tests/regression/replaygain.liq +5 -0
- package/tests/liquidsoap/tests/regression/shoutcast-args.liq +9 -0
- package/tests/liquidsoap/tests/regression/unified-pcm-types.liq +10 -0
- package/tests/liquidsoap/tests/regression/video-only.liq +7 -0
- package/tests/liquidsoap/tests/run_test.ml +97 -0
- package/tests/liquidsoap/tests/streams/195.liq +4 -0
- package/tests/liquidsoap/tests/streams/197.liq +23 -0
- package/tests/liquidsoap/tests/streams/autostart.liq +27 -0
- package/tests/liquidsoap/tests/streams/cross-override.liq +43 -0
- package/tests/liquidsoap/tests/streams/cross-persist-override.liq +43 -0
- package/tests/liquidsoap/tests/streams/cross.liq +44 -0
- package/tests/liquidsoap/tests/streams/crossfade.liq +41 -0
- package/tests/liquidsoap/tests/streams/ctype1.liq +13 -0
- package/tests/liquidsoap/tests/streams/ctype2.liq +21 -0
- package/tests/liquidsoap/tests/streams/dtmf.liq +23 -0
- package/tests/liquidsoap/tests/streams/dtmf_pcm_s16.liq +26 -0
- package/tests/liquidsoap/tests/streams/dune +298 -0
- package/tests/liquidsoap/tests/streams/dune.inc +1078 -0
- package/tests/liquidsoap/tests/streams/fades-overrides.liq +58 -0
- package/tests/liquidsoap/tests/streams/fades-persistent-override.liq +58 -0
- package/tests/liquidsoap/tests/streams/ffmpeg-errors.liq +16 -0
- package/tests/liquidsoap/tests/streams/ffmpeg-trim.liq +17 -0
- package/tests/liquidsoap/tests/streams/file_output.liq +14 -0
- package/tests/liquidsoap/tests/streams/gen_dune.ml +45 -0
- package/tests/liquidsoap/tests/streams/harbor_kick_client.liq +58 -0
- package/tests/liquidsoap/tests/streams/harbor_metadata.liq +53 -0
- package/tests/liquidsoap/tests/streams/hls_custom_tags.liq +89 -0
- package/tests/liquidsoap/tests/streams/hls_id3v2.liq +134 -0
- package/tests/liquidsoap/tests/streams/hls_main_playlist.liq +54 -0
- package/tests/liquidsoap/tests/streams/huge-playlist.liq +25 -0
- package/tests/liquidsoap/tests/streams/icecast_ssl.liq +25 -0
- package/tests/liquidsoap/tests/streams/icecast_ssl_tls.liq +32 -0
- package/tests/liquidsoap/tests/streams/icecast_tls.liq +30 -0
- package/tests/liquidsoap/tests/streams/icecast_tls_ssl.liq +32 -0
- package/tests/liquidsoap/tests/streams/image.liq +4 -0
- package/tests/liquidsoap/tests/streams/many-playlists.liq +28 -0
- package/tests/liquidsoap/tests/streams/merge_metadata.liq +69 -0
- package/tests/liquidsoap/tests/streams/never.liq +6 -0
- package/tests/liquidsoap/tests/streams/on_frame.liq +14 -0
- package/tests/liquidsoap/tests/streams/on_metadata.liq +22 -0
- package/tests/liquidsoap/tests/streams/on_track.liq +12 -0
- package/tests/liquidsoap/tests/streams/playlist-watch.liq +43 -0
- package/tests/liquidsoap/tests/streams/radio.liq +11 -0
- package/tests/liquidsoap/tests/streams/radio2.liq +20 -0
- package/tests/liquidsoap/tests/streams/random.liq +70 -0
- package/tests/liquidsoap/tests/streams/replaygain.liq +11 -0
- package/tests/liquidsoap/tests/streams/request.liq +75 -0
- package/tests/liquidsoap/tests/streams/rotate.liq +44 -0
- package/tests/liquidsoap/tests/streams/say.liq +24 -0
- package/tests/liquidsoap/tests/streams/seek_track_map.liq +23 -0
- package/tests/liquidsoap/tests/streams/sharing.liq +17 -0
- package/tests/liquidsoap/tests/streams/sine.detect.full_conv.liq +17 -0
- package/tests/liquidsoap/tests/streams/sine.detect.liq +12 -0
- package/tests/liquidsoap/tests/streams/sine.detect.pcm_f32.liq +14 -0
- package/tests/liquidsoap/tests/streams/sine.detect.pcm_s16.liq +14 -0
- package/tests/liquidsoap/tests/streams/smart-crossfade.liq +11 -0
- package/tests/liquidsoap/tests/streams/srt_listen_callback.liq +24 -0
- package/tests/liquidsoap/tests/streams/srt_multiple_outputs.liq +16 -0
- package/tests/liquidsoap/tests/streams/srt_passphrase.liq +19 -0
- package/tests/liquidsoap/tests/streams/srt_raw_pcm.liq +13 -0
- package/tests/liquidsoap/tests/streams/stretch-clock-propagation.liq +13 -0
- package/tests/liquidsoap/tests/test.liq +237 -0
- package/tests/liquidsoap/tls-liquidsoap.opam +33 -0
- package/tests/run.sh +18 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,1382 @@
|
|
|
1
|
+
# Liquidsoap's scripting language
|
|
2
|
+
|
|
3
|
+
_The following is adapted from the [Liquidsoap book](book.html). The reader is avised to check out the whole
|
|
4
|
+
chapter in the book for more details about the liquidsoap language_
|
|
5
|
+
|
|
6
|
+
## General features
|
|
7
|
+
|
|
8
|
+
Liquidsoap is a novel language which was designed from scratch to handle media stream. It takes some inspiration
|
|
9
|
+
from functional languages such as [OCaml](https://ocaml.org/) but features a syntax that is more intuitive to the
|
|
10
|
+
general purpose programmer, similar to Ruby or Javascript.
|
|
11
|
+
|
|
12
|
+
### Typing
|
|
13
|
+
|
|
14
|
+
One of the main features of the language is that it is _typed_. This means that
|
|
15
|
+
every expression belongs to some type which indicates what it is. For instance,
|
|
16
|
+
`"hello"` is a _string_ whereas `23` is an _integer_, and, when presenting a
|
|
17
|
+
construction of the language, we will always indicate the associated
|
|
18
|
+
type. Liquidsoap implements a _typechecking_ algorithm which ensures that
|
|
19
|
+
whenever a string is expected a string will actually be given, and similarly for
|
|
20
|
+
other types. This is done without running the program, so that it does not
|
|
21
|
+
depend on some dynamic tests, but is rather enforced by theoretical
|
|
22
|
+
considerations. Another distinguishing feature of this algorithm is that it also
|
|
23
|
+
performs _type inference_: you never actually have to write a type, those are
|
|
24
|
+
guessed automatically by Liquidsoap. This makes the language very safe, while
|
|
25
|
+
remaining very easy to use.
|
|
26
|
+
|
|
27
|
+
### Functional programming
|
|
28
|
+
|
|
29
|
+
The language is _functional_, which means that you can very easily define
|
|
30
|
+
functions, and that functions can be passed as arguments of other
|
|
31
|
+
functions. This might look like a crazy thing at first, but it is actually quite
|
|
32
|
+
common in some language communities (such as OCaml). It also might look quite
|
|
33
|
+
useless: why should we need such functions when describing webradios? You will
|
|
34
|
+
soon discover that it happens to be quite convenient in many places: for
|
|
35
|
+
handlers (we can specify the function which describes what to do when some event
|
|
36
|
+
occurs such as when a DJ connects to the radio), for transitions (we pass a
|
|
37
|
+
function which describes the shape we want for the transition) and so on.
|
|
38
|
+
|
|
39
|
+
### Streams
|
|
40
|
+
|
|
41
|
+
The unique feature of Liquidsoap is that it allows the manipulation of _sources_
|
|
42
|
+
which are functions which will generate streams. These streams typically consist
|
|
43
|
+
of stereo audio data, but we do restrict to this: they can contain audio with
|
|
44
|
+
arbitrary number of channels, they can also contain an arbitrary number of video
|
|
45
|
+
channels, and also MIDI channels (there is limited support for sound synthesis).
|
|
46
|
+
|
|
47
|
+
### Standard library
|
|
48
|
+
|
|
49
|
+
Although the core of Liquidsoap is written in OCaml, many of the functions of
|
|
50
|
+
Liquidsoap are written in the Liquidsoap language itself. Those are defined in
|
|
51
|
+
the `stdlib.liq` script, which is loaded by default and includes all the
|
|
52
|
+
libraries. You should not be frightened to have a look at the standard library,
|
|
53
|
+
it is often useful to better grasp the language, learn design patterns and
|
|
54
|
+
tricks, and add functionalities. Its location on your system is indicated in the
|
|
55
|
+
variable `configure.libdir` and can be obtained by typing
|
|
56
|
+
|
|
57
|
+
## Basic values
|
|
58
|
+
|
|
59
|
+
### Integers and floats
|
|
60
|
+
|
|
61
|
+
The _integers_, such as `3` or `42`, are of type
|
|
62
|
+
`int`. Depending on the current architecture of the
|
|
63
|
+
computer on which we are executing the script (32 or 64 bits, the latter being
|
|
64
|
+
the most common nowadays) they are stored on 31 or 63 bits. The minimal
|
|
65
|
+
(resp. maximal) representable integer can be obtained as the constant
|
|
66
|
+
`min_int`
|
|
67
|
+
(resp. `max_int`); typically, on a 64 bits
|
|
68
|
+
architecture, they range from -4611686018427387904 to 4611686018427387903.
|
|
69
|
+
|
|
70
|
+
The _floating point numbers_, such as `2.45`, are of type
|
|
71
|
+
`float`, and are in double precision, meaning that
|
|
72
|
+
they are always stored on 64 bits. We always write a decimal point in them,
|
|
73
|
+
so that `3` and `3.` are not the same thing: the former is an integer and the
|
|
74
|
+
latter is a float. This is a source of errors for beginners, but is necessary for
|
|
75
|
+
typing to work well.
|
|
76
|
+
|
|
77
|
+
### Strings
|
|
78
|
+
|
|
79
|
+
Strings are written between double or single quotes,
|
|
80
|
+
e.g. `"hello!"` or `'hello!'`, and are of type `string`.
|
|
81
|
+
|
|
82
|
+
In order to write the character "`"`" in a string, one cannot simply type "`"`"
|
|
83
|
+
since this is already used to indicate the boundaries of a string: this
|
|
84
|
+
character should be _escaped_, which
|
|
85
|
+
means that the character "`\`" should be typed first so that
|
|
86
|
+
|
|
87
|
+
```liquidsoap
|
|
88
|
+
print("My name is \"Sam\"!")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
will actually display "`My name is "Sam"!`". Other commonly used escaped
|
|
92
|
+
characters are "`\\`" for backslash and "`\n`" for new line. Alternatively, one
|
|
93
|
+
can use the single quote notation, so that previous example can also be written
|
|
94
|
+
as
|
|
95
|
+
|
|
96
|
+
```liquidsoap
|
|
97
|
+
print('My name is "Sam"!')
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This is most often used when testing JSON data which can contain many quotes or for
|
|
101
|
+
command line arguments when calling external scripts. The character "`\`" can also
|
|
102
|
+
be used at the end of the string to break long strings in scripts without
|
|
103
|
+
actually inserting newlines in the strings. For instance, the script
|
|
104
|
+
|
|
105
|
+
```liquidsoap
|
|
106
|
+
print("His name is \
|
|
107
|
+
Romain.")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
will actually print
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
His name is Romain.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Note that there is no line change between "is" and "Romain", and the indentation
|
|
117
|
+
before "Romain" is not shown either.
|
|
118
|
+
|
|
119
|
+
The concatenation of two strings is achieved by the infix operator "`^`", as in
|
|
120
|
+
|
|
121
|
+
```liquidsoap
|
|
122
|
+
user = "dj"
|
|
123
|
+
print("Current user is " ^ user)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Instead of using concatenation, it is often rather convenient to use _string
|
|
127
|
+
interpolation_: in a string, `#{e}` is replaced by the string representation of
|
|
128
|
+
the result of the evaluation of the expression `e`:
|
|
129
|
+
|
|
130
|
+
```liquidsoap
|
|
131
|
+
user = "admin"
|
|
132
|
+
print("The user #{user} has just logged.")
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
will print `The user admin has just logged.` or
|
|
136
|
+
|
|
137
|
+
```liquidsoap
|
|
138
|
+
print("The number #{random.float()} is random.")
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
will print `The number 0.663455738438 is random.` (at least it did last time I
|
|
142
|
+
tried).
|
|
143
|
+
|
|
144
|
+
#### Escaping strings
|
|
145
|
+
|
|
146
|
+
Liquidsoap strings follow the most common lexical conventions from `C` and `javascript` and `JSON`, in particular,
|
|
147
|
+
`string.unescape` recognizes the same escape sequences as `C` (except for `UTF-16` characters) and javascript.
|
|
148
|
+
|
|
149
|
+
The following sequences are recognized:
|
|
150
|
+
|
|
151
|
+
| Escape sequence | Hex value in ASCII | Character represented |
|
|
152
|
+
| --------------- | ------------------ | ------------------------------------------------------------------------------------- |
|
|
153
|
+
| `\a` | `\x07` | Alert (Beep, Bell) |
|
|
154
|
+
| `\b` | `\x08` | Backspace |
|
|
155
|
+
| `\e` | `\x1B` | Escape character |
|
|
156
|
+
| `\f` | `\x0C` | Formfeed, Page Break |
|
|
157
|
+
| `\n` | `\x0A` | Newline (Line Feed) |
|
|
158
|
+
| `\r` | `\x0D` | Carriage Return |
|
|
159
|
+
| `\t` | `\x09` | Horizontal Tab |
|
|
160
|
+
| `\v` | `\x0B` | Vertical Tab |
|
|
161
|
+
| `\\` | `\x5C` | Backslash |
|
|
162
|
+
| `\/` | `\x2f` | Forward slash |
|
|
163
|
+
| `\'` | `\x27` | Apostrophe or single quotation mark |
|
|
164
|
+
| `\"` | `\x22` | Double quotation mark |
|
|
165
|
+
| `\?` | `\x3F` | Question mark (used to avoid Digraphs and trigraphs) |
|
|
166
|
+
| `\nnn` | any | The byte whose numerical value is given by _nnn_ interpreted as an _octal_ number |
|
|
167
|
+
| `\xhh` | any | The byte whose numerical value is given by _hh_ interpreted as a _hexadecimal_ number |
|
|
168
|
+
| `\uhhhh` | none | UTF8-8 code point given by _hhhh_ interpreted as an _hexadecimal_ number |
|
|
169
|
+
|
|
170
|
+
This convention has been decided to follow the most common practices. In particular, `\nnn` is an _octal_ escape sequence in most languages
|
|
171
|
+
including C, Ruby, Javascript, Python and more. This differs from OCaml where `\nnn` is considered a _digital_ escape sequence.
|
|
172
|
+
|
|
173
|
+
These lexical conventions are used in the default `string.escape` and `string.unescape`.
|
|
174
|
+
|
|
175
|
+
Here's an example of an escaped string:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
# "\" \t \045 \x2f \u4f32";;
|
|
179
|
+
- : string = "\" \t % / 2"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The function `string.quote` returns [JSON-compatible](https://www.json.org/json-en.html) strings.
|
|
183
|
+
|
|
184
|
+
### Regular expressions
|
|
185
|
+
|
|
186
|
+
_This feature was introduced in liquidsoap version 2.1.0_
|
|
187
|
+
|
|
188
|
+
Regular expressions can be created using the `regexp` operator or the syntactic sugar: `r/.../<flags>`. For instance:
|
|
189
|
+
|
|
190
|
+
```liquidsoap
|
|
191
|
+
# Using the regexp operator:
|
|
192
|
+
r = regexp(flags=["g","i"], "foo([\\w])+bar")
|
|
193
|
+
|
|
194
|
+
# Using the r/../ syntactic sugar:
|
|
195
|
+
r = r/foo([\w])bar/gi
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Using the `r/../` syntactic sugar makes it possible to write regular expressions without having to escape `\` characters,
|
|
199
|
+
which makes them more easily readable.
|
|
200
|
+
|
|
201
|
+
Regular expression flags are:
|
|
202
|
+
|
|
203
|
+
- `i`: perform case-insensitive match
|
|
204
|
+
- `g`: substitute all matched sub-strings, not just the first one
|
|
205
|
+
- `s`: match all characters, including `\n` when using the `.` pattern
|
|
206
|
+
- `m`: `^` and `$` match before/after newlines, not just at the beginning/end of a string
|
|
207
|
+
|
|
208
|
+
Regular expressions have the following methods:
|
|
209
|
+
|
|
210
|
+
- `replace(fn, s)`: replace matched substrings of `s` using function `fn`. If the `g` flag is not passed, only the first match is replaced otherwise, all matches are replaced
|
|
211
|
+
- `split(s)`: split the given string on all substrings matching the regular expression.
|
|
212
|
+
- `test(s)`: returns `true` if the given string matches the regular expression.
|
|
213
|
+
- `exec(s)`: execute the regular expression and return a of list matches of the form: `[(<match index>, <match>), ..]`. Named matches are also supported and returned as property `groups` of type `[string * string]`:
|
|
214
|
+
|
|
215
|
+
```liquidsoap
|
|
216
|
+
r/(foo)(?<gno>gni)?/g.exec("foogni")
|
|
217
|
+
- : [int * string].{groups : [string * string]} =
|
|
218
|
+
[
|
|
219
|
+
(2, "gni"),
|
|
220
|
+
(1, "foo"),
|
|
221
|
+
(0, "foogni")
|
|
222
|
+
].{
|
|
223
|
+
groups = [
|
|
224
|
+
("gno", "gni")
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Booleans
|
|
230
|
+
|
|
231
|
+
The _booleans_ are either `true` or
|
|
232
|
+
`false` and are of type `bool`. They can be combined
|
|
233
|
+
using the usual boolean operations
|
|
234
|
+
|
|
235
|
+
- `and`: conjunction,
|
|
236
|
+
- `or`: disjunction,
|
|
237
|
+
- `not`: negation.
|
|
238
|
+
|
|
239
|
+
Booleans typically originate from comparison operators, which take two values
|
|
240
|
+
and return booleans:
|
|
241
|
+
|
|
242
|
+
- `==`: compares for equality,
|
|
243
|
+
- `!=`: compares for inequality,
|
|
244
|
+
- `<=`: compares for inequality,
|
|
245
|
+
|
|
246
|
+
and so on (`<`, `>=`, `>`). For instance, the following is a boolean expression:
|
|
247
|
+
|
|
248
|
+
```liquidsoap
|
|
249
|
+
(n < 3) and not (s == "hello")
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
_Conditional branchings_ execute code depending on whether a condition is true
|
|
253
|
+
or not. For instance, the code
|
|
254
|
+
|
|
255
|
+
```liquidsoap
|
|
256
|
+
if (1 <= x and x <= 12) or (not 10h-15h) then
|
|
257
|
+
print("The condition is satisfied")
|
|
258
|
+
else
|
|
259
|
+
print("The condition ain't satisfied")
|
|
260
|
+
end
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
will print that the condition is satisfied when either `x` is between 1 and 12
|
|
264
|
+
or the current time is not between 10h and 15h. A conditional branching might
|
|
265
|
+
return a value, which is the last computed value in the chosen branch. For
|
|
266
|
+
instance,
|
|
267
|
+
|
|
268
|
+
```liquidsoap
|
|
269
|
+
y = if x < 3 then "A" else "B" end
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
will assign `"A"` or `"B"` to `y` depending on whether `x` is below 3 or
|
|
273
|
+
not. The two branches of a conditional should always have the same return type:
|
|
274
|
+
|
|
275
|
+
```liquidsoap
|
|
276
|
+
x = if 1 == 2 then "A" else 5 end
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
will result in
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
At line 1, char 19-21:
|
|
283
|
+
Error 5: this value has type string
|
|
284
|
+
but it should be a subtype of int
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
meaning that `"A"` is a string but is expected to be an integer because the
|
|
288
|
+
second branch returns an integer, and the two should be of same nature. The
|
|
289
|
+
`else` branch is optional, in which case the `then` branch should be of type
|
|
290
|
+
`unit`:
|
|
291
|
+
|
|
292
|
+
```liquidsoap
|
|
293
|
+
if x == "admin" then print("Welcome admin") end
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
In the case where you want to perform a conditional branching in the
|
|
297
|
+
`else` branch, the `elsif`{.liquidsoap} keyword should be used, as
|
|
298
|
+
in the following example, which assigns 0, 1, 2 or 3 to `s` depending on whether
|
|
299
|
+
`x` is `"a"`, `"b"`, `"c"` or something else:
|
|
300
|
+
|
|
301
|
+
```liquidsoap
|
|
302
|
+
s = if x == "a" then 0
|
|
303
|
+
elsif x == "b" then 1
|
|
304
|
+
elsif x == "c" then 2
|
|
305
|
+
else 3 end
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
This is equivalent (but shorter to write) to the following sequence of
|
|
309
|
+
imbricated conditional branchings:
|
|
310
|
+
|
|
311
|
+
```liquidsoap
|
|
312
|
+
s = if x == "a" then 0
|
|
313
|
+
else
|
|
314
|
+
if x == "b" then 1
|
|
315
|
+
else
|
|
316
|
+
if x == "c" then 2
|
|
317
|
+
else 3 end
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Finally, we should mention that the notation `c?a:b` is also available as a
|
|
323
|
+
shorthand for `if c then a else b end`, so that the expression
|
|
324
|
+
|
|
325
|
+
```liquidsoap
|
|
326
|
+
y = if x < 3 then "A" else "B" end
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
can be shortened to
|
|
330
|
+
|
|
331
|
+
```liquidsoap
|
|
332
|
+
y = (x<3)?"A":"B"
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
(and people will think that you are a cool guy).
|
|
336
|
+
|
|
337
|
+
#### Time predicates
|
|
338
|
+
|
|
339
|
+
Time predicates are special boolean values such as `{0h-7h}`. These values are
|
|
340
|
+
`true` or `false` depending on the current time. Some examples of time
|
|
341
|
+
predicates are
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
`{11h15-13h}` between 11h15 and 13h
|
|
346
|
+
`{12h}` between 12h00 and 12h59
|
|
347
|
+
`{12h00}` at 12h00
|
|
348
|
+
`{00m}` on the first minute of every hour
|
|
349
|
+
`{00m-09m}` on the first 10 minutes of every hour
|
|
350
|
+
`{2w}` on Tuesday
|
|
351
|
+
`{6w-7w}` on weekends
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
Above, `w` stands for weekday: 1 is Monday, 2 is Tuesday, and so on. Sunday is
|
|
356
|
+
both 0 and 7.
|
|
357
|
+
|
|
358
|
+
Time predicate can also be parsed at runtime, for instance if you want to create
|
|
359
|
+
them dynamically. The syntax is:
|
|
360
|
+
|
|
361
|
+
```liquidsoap
|
|
362
|
+
# f = time.predicate("00m-30m");;
|
|
363
|
+
f : () -> bool = <fun>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Be aware that, if parsing fails, it will raise `error.string`:
|
|
367
|
+
|
|
368
|
+
```liquidsoap
|
|
369
|
+
# f = time.predicate("foo")
|
|
370
|
+
Error 14: Uncaught runtime error:
|
|
371
|
+
type: string, message: "Failed to parse foo as time predicate"
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Unit
|
|
375
|
+
|
|
376
|
+
Some functions, such as `print`, do not return a meaningful value: we are
|
|
377
|
+
interested in what they are doing (e.g. printing on the standard output) and not
|
|
378
|
+
in their result. However, since typing requires that everything returns
|
|
379
|
+
something of some type, there is a particular type for the return of such
|
|
380
|
+
functions: `unit`. Just as there are only two values in the booleans (`true` and
|
|
381
|
+
`false`), there is only one value in the unit type, which is written `()`. This
|
|
382
|
+
value can be thought of as the result of the expression saying "I'm done".
|
|
383
|
+
|
|
384
|
+
### Lists
|
|
385
|
+
|
|
386
|
+
Some more elaborate values can be constructed by combining the previous ones. A
|
|
387
|
+
first kind is _lists_ which are finite sequences of values, being all of the
|
|
388
|
+
same type. They are constructed by square bracketing the sequence whose elements
|
|
389
|
+
are separated by commas. For instance, the list
|
|
390
|
+
|
|
391
|
+
```liquidsoap
|
|
392
|
+
[1, 4, 5]
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
is a list of three integers (1, 4 and 5), and its type is `[int]`, and the type
|
|
396
|
+
of `["A", "B"]` would obviously be `[string]`. Note that a list can
|
|
397
|
+
be empty: `[]`.
|
|
398
|
+
|
|
399
|
+
You can extract list elements through _splats_ such as
|
|
400
|
+
|
|
401
|
+
```liquidsoap
|
|
402
|
+
l = [1, 5, 7, 8, 9]
|
|
403
|
+
let [x, _, z, ...t] = l
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
In this example, the value of `x` is `1`, the value of `z` is `7` and the value of `t`
|
|
407
|
+
is [`8, 9]`.
|
|
408
|
+
|
|
409
|
+
You can also combine lists in a similar way
|
|
410
|
+
|
|
411
|
+
```liquidsoap
|
|
412
|
+
x = [1, ...[2, 3, 4], 5, ...[6, 7]]
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
In this example, the value of `x` is `[1, 2, 3, 4, 5, 6 ,7]`
|
|
416
|
+
|
|
417
|
+
### Tuples
|
|
418
|
+
|
|
419
|
+
Another construction present in Liquidsoap is _tuples_ of values, which are
|
|
420
|
+
finite sequences of values which, contrarily to lists, might have different
|
|
421
|
+
types. For instance,
|
|
422
|
+
|
|
423
|
+
```
|
|
424
|
+
(3, 4.2, "hello")
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
is a triple (a tuple with three elements) of type
|
|
428
|
+
|
|
429
|
+
```
|
|
430
|
+
int * float * string
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
which indicate that the first element is an integer, the second a float and the
|
|
434
|
+
third a string.
|
|
435
|
+
|
|
436
|
+
Similarly to lists, there is a special syntax in order to access
|
|
437
|
+
tuple elements. For instance, if `t` is the above tuple `(3, 4.2, "hello")`, we can write
|
|
438
|
+
|
|
439
|
+
```liquidsoap
|
|
440
|
+
let (n, x, s) = t
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
which will assign the first element to the variable `n`, the second element to
|
|
444
|
+
the variable `x` and the third element to the variable `s`.
|
|
445
|
+
|
|
446
|
+
## Programming primitives
|
|
447
|
+
|
|
448
|
+
### Variables
|
|
449
|
+
|
|
450
|
+
We have already seen many examples of uses of _variables_: we use
|
|
451
|
+
|
|
452
|
+
```liquidsoap
|
|
453
|
+
x = e
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
in order to assign the result of evaluating an expression `e` to a
|
|
457
|
+
variable `x`, which can later on be referred to as `x`. Variables can be masked:
|
|
458
|
+
we can define two variables with the same name, and at any point in the program the
|
|
459
|
+
last defined value for the variable is used:
|
|
460
|
+
|
|
461
|
+
```liquidsoap
|
|
462
|
+
n = 3
|
|
463
|
+
print(n)
|
|
464
|
+
n = n + 2
|
|
465
|
+
print(n)
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
will print `3` and `5`. Contrarily to most languages, the value for a variable
|
|
469
|
+
cannot be changed (unless we explicitly require this by using references, see
|
|
470
|
+
below), so the above program does not modify the value of `n`, it is simply that
|
|
471
|
+
a new `n` is defined.
|
|
472
|
+
|
|
473
|
+
There is an alternative syntax for declaring variables which is
|
|
474
|
+
|
|
475
|
+
```liquidsoap
|
|
476
|
+
def x =
|
|
477
|
+
e
|
|
478
|
+
end
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
It has the advantage that the expression `e` can spread over multiple lines and
|
|
482
|
+
thus consist of multiple expressions, in which case the value of the last one
|
|
483
|
+
will be assigned to `x`. This is particularly useful to use local variables when defining a value.
|
|
484
|
+
|
|
485
|
+
### References
|
|
486
|
+
|
|
487
|
+
As indicated above, by default, the value of a variable cannot be
|
|
488
|
+
changed. However, one can use a _reference_ in order to be able to do this.
|
|
489
|
+
Those can be seen as memory cells, containing values of a given fixed type,
|
|
490
|
+
which can be modified during the execution of the program. They are created with
|
|
491
|
+
the `ref` keyword, with the initial value of the cell as argument. For instance,
|
|
492
|
+
|
|
493
|
+
```liquidsoap
|
|
494
|
+
r = ref(5)
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
declares that `r` is a reference which contains `5` as initial value. Since `5`
|
|
498
|
+
is an integer (of type `int`), the type of the reference `r` will be
|
|
499
|
+
|
|
500
|
+
```
|
|
501
|
+
ref(int)
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
meaning that its a memory cell containing integers. On such a reference, two
|
|
505
|
+
operations are available.
|
|
506
|
+
|
|
507
|
+
- One can obtain the value of the reference by applying the reference to `()`,
|
|
508
|
+
so that `r()` denotes the value contained in the reference `r`, for instance
|
|
509
|
+
|
|
510
|
+
```liquidsoap
|
|
511
|
+
x = r() + 4
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
declares the variable `x` as being 9 (which is 5+4).
|
|
515
|
+
|
|
516
|
+
- One can change the value of the reference by using the `:=` keyword, e.g.
|
|
517
|
+
|
|
518
|
+
```liquidsoap
|
|
519
|
+
r := 2
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
will assign the value 2 to `r`. Internally, this is done by calling the `set`
|
|
523
|
+
method of the reference, so that the above is equivalent to writing
|
|
524
|
+
|
|
525
|
+
```liquidsoap
|
|
526
|
+
r.set(2)
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
which used to be the syntax for some reference manipulations.
|
|
530
|
+
|
|
531
|
+
### Loops
|
|
532
|
+
|
|
533
|
+
The usual looping constructions are available in Liquidsoap. The `for` loop
|
|
534
|
+
repeatedly executes a portion of code with an integer variable varying between
|
|
535
|
+
two bounds, being increased by one each time. For instance, the following code
|
|
536
|
+
will print the integers `1`, `2`, `3`, `4` and `5`, which are the values
|
|
537
|
+
successively taken by the variable `i`:
|
|
538
|
+
|
|
539
|
+
```liquidsoap
|
|
540
|
+
for i = 1 to 5 do
|
|
541
|
+
print(i)
|
|
542
|
+
end
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
In practice, such loops could be used to add a bunch of numbered files
|
|
546
|
+
(e.g. `music1.mp3`, `music2.mp3`, `music3.mp3`, etc.) in a request queue for
|
|
547
|
+
instance.
|
|
548
|
+
|
|
549
|
+
The `while` loop repeatedly executes a portion of code, as long a condition is
|
|
550
|
+
satisfied. For instance, the following code doubles the contents of the
|
|
551
|
+
reference `n` as long as its value is below `10`:
|
|
552
|
+
|
|
553
|
+
```liquidsoap
|
|
554
|
+
n = ref(1)
|
|
555
|
+
while n() < 10 do
|
|
556
|
+
n := n() * 2
|
|
557
|
+
end
|
|
558
|
+
print(n())
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
The variable `n` will thus successively take the values `1`, `2`, `4`, `8` and
|
|
562
|
+
`16`, at which point the looping condition `n() < 10` is not satisfied anymore
|
|
563
|
+
and the loop is exited. The printed value is thus `16`.
|
|
564
|
+
|
|
565
|
+
## Functions
|
|
566
|
+
|
|
567
|
+
Liquidsoap is built around the notion of function: most operations are performed
|
|
568
|
+
by those. For some reason, we sometimes call _operators_ the functions acting on
|
|
569
|
+
sources. Liquidsoap includes a standard library which consists of functions
|
|
570
|
+
defined in the Liquidsoap language, including fairly complex operators such as
|
|
571
|
+
`playlist` which plays a playlist or `crossfade` which takes care of fading
|
|
572
|
+
between songs.
|
|
573
|
+
|
|
574
|
+
### Basics
|
|
575
|
+
|
|
576
|
+
A function is a construction which takes a bunch of arguments and produces a
|
|
577
|
+
result. For instance, we can define a function `f` taking two float arguments,
|
|
578
|
+
prints the first and returns the result of adding twice the first to the second:
|
|
579
|
+
|
|
580
|
+
```liquidsoap
|
|
581
|
+
def f(x, y)
|
|
582
|
+
print(x)
|
|
583
|
+
2*x+y
|
|
584
|
+
end
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
This function can also be written on one line if we use semicolons (`;`) to
|
|
588
|
+
separate the instructions instead of changing line:
|
|
589
|
+
|
|
590
|
+
```liquidsoap
|
|
591
|
+
def f(x, y) = print(x); 2*x+y end
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
The type of this function is
|
|
595
|
+
|
|
596
|
+
```
|
|
597
|
+
(int, int) -> int
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
The arrow `->` means that it is a function, on the left are the types of the
|
|
601
|
+
arguments (here, two arguments of type `int`) and on the right is the type of
|
|
602
|
+
the returned value of the function (here, `int`). In order to use this function,
|
|
603
|
+
we have to apply it to arguments, as in
|
|
604
|
+
|
|
605
|
+
```
|
|
606
|
+
f(3, 4)
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
This will trigger the evaluation of the function, where the argument `x`
|
|
610
|
+
(resp. `y`) is replaced by `3` (resp. `4`), i.e., it will print `3` and return
|
|
611
|
+
the evaluation of `2*3+4`, which is `10`.
|
|
612
|
+
|
|
613
|
+
### Anonymous functions
|
|
614
|
+
|
|
615
|
+
For concision in scripts, it is possible define a function without giving it a
|
|
616
|
+
name, using the syntax
|
|
617
|
+
|
|
618
|
+
```liquidsoap
|
|
619
|
+
fun (x) -> ...
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
This is called an _anonymous function_, and it is typically used in order to
|
|
623
|
+
specify short handlers in arguments.
|
|
624
|
+
|
|
625
|
+
#### Anonymous function with no arguments
|
|
626
|
+
|
|
627
|
+
You will see that it is quite common to use anonymous functions with no
|
|
628
|
+
arguments. For this reason, we have introduced a special convenient syntax for
|
|
629
|
+
those and allow writing
|
|
630
|
+
|
|
631
|
+
```liquidsoap
|
|
632
|
+
{...}
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
instead of
|
|
636
|
+
|
|
637
|
+
```liquidsoap
|
|
638
|
+
fun () -> ...
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
### Labeled arguments
|
|
642
|
+
|
|
643
|
+
A function can have an arbitrary number of arguments, and when there are many of them it
|
|
644
|
+
becomes difficult to keep track of their order and their order matter! For
|
|
645
|
+
instance, the following function computes the sample rate given a number of
|
|
646
|
+
samples in a given period of time:
|
|
647
|
+
|
|
648
|
+
```liquidsoap
|
|
649
|
+
def samplerate(samples, duration) = samples / duration end
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
which is of type
|
|
653
|
+
|
|
654
|
+
```
|
|
655
|
+
(float, float) -> float
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
For instance, if you have 110250 samples over 2.5 seconds the samplerate will be
|
|
659
|
+
`samplerate(110250., 2.5)` which is 44100. However, if you mix the
|
|
660
|
+
order of the arguments and type `samplerate(2.5, 110250.)`, you
|
|
661
|
+
will get quite a different result and this will not be detected by
|
|
662
|
+
the typing system because both arguments have the same type. Fortunately, we can
|
|
663
|
+
give _labels_ to arguments in order to prevent this, which forces explicitly
|
|
664
|
+
naming the arguments. This is indicated by prefixing the arguments with a tilde
|
|
665
|
+
"`~`":
|
|
666
|
+
|
|
667
|
+
```liquidsoap
|
|
668
|
+
def samplerate(~samples, ~duration) = samples / duration end
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
The labels will be indicated as follows in the type:
|
|
672
|
+
|
|
673
|
+
```
|
|
674
|
+
(samples : float, duration : float) -> float
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Namely, in the above type, we read that the argument labeled `samples` is a
|
|
678
|
+
float and similarly for the one labeled `duration`. For those arguments, we have
|
|
679
|
+
to give the name of the argument when calling the function:
|
|
680
|
+
|
|
681
|
+
```liquidsoap
|
|
682
|
+
samplerate(samples=110250., duration=2.5)
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
The nice byproduct is that the order of the arguments does not matter anymore, the
|
|
686
|
+
following will give the same result:
|
|
687
|
+
|
|
688
|
+
```liquidsoap
|
|
689
|
+
samplerate(duration=2.5, samples=110250.)
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
Of course, a function can have both labeled and non-labeled arguments.
|
|
693
|
+
|
|
694
|
+
### Optional arguments
|
|
695
|
+
|
|
696
|
+
Another useful feature is that we can give _default values_ to arguments, which
|
|
697
|
+
thus become _optional_: if, when calling the function, a value is not specified
|
|
698
|
+
for such arguments, the default value will be used. For instance, if for some
|
|
699
|
+
reason we tend to generally measure samples over a period of 2.5 seconds, we can
|
|
700
|
+
make this become the value for the `duration` parameter:
|
|
701
|
+
|
|
702
|
+
```{.liquidsoap include="liq/samplerate3.liq" from=0 to=0}
|
|
703
|
+
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
In this way, if we do not specify a value for the duration, its value will
|
|
707
|
+
implicitly be assumed to be 2.5, so that the expression:
|
|
708
|
+
|
|
709
|
+
```liquidsoap
|
|
710
|
+
samplerate(samples=110250.)
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
will still evaluate to 44100. Of course, if we want to use another value for the
|
|
714
|
+
duration, we can still specify it, in which case the default value will be
|
|
715
|
+
ignored:
|
|
716
|
+
|
|
717
|
+
```liquidsoap
|
|
718
|
+
samplerate(samples=132300., duration=3.)
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
The presence of an optional argument is indicated in the type by prefixing the
|
|
722
|
+
corresponding label with "`?`", so that the type of the above function is
|
|
723
|
+
|
|
724
|
+
```
|
|
725
|
+
(samples : float, ?duration : float) -> float
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
### Getters
|
|
729
|
+
|
|
730
|
+
We often want to be able to dynamically modify some parameters in a script. For
|
|
731
|
+
instance, consider the operator `amplify`, which takes a float and an audio
|
|
732
|
+
source and returns the audio amplified by the given volume factor: we can expect
|
|
733
|
+
its type to be
|
|
734
|
+
|
|
735
|
+
```
|
|
736
|
+
(float, source('a)) -> source('a)
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
so that we can use it to have a radio consisting of a microphone input amplified
|
|
740
|
+
by a factor 1.2 by
|
|
741
|
+
|
|
742
|
+
```liquidsoap
|
|
743
|
+
mic = input.alsa()
|
|
744
|
+
radio = amplify(1.2, mic)
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
In the above example, the volume 1.2 was supposedly chosen because the sound
|
|
748
|
+
delivered by the microphone is not loud enough, but this loudness can vary from
|
|
749
|
+
time to time, depending on the speaker for instance, and we would like to be
|
|
750
|
+
able to dynamically update it. The problem with the current operator is that the
|
|
751
|
+
volume is of type `float` and a float cannot change over time: it has a fixed
|
|
752
|
+
value.
|
|
753
|
+
|
|
754
|
+
In order for the volume to have the possibility to vary over time, instead of
|
|
755
|
+
having a `float` argument for `amplify`, we have decided to have instead an
|
|
756
|
+
argument of type
|
|
757
|
+
|
|
758
|
+
```
|
|
759
|
+
() -> float
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
This is a function which takes no argument and returns a float (remember that a
|
|
763
|
+
function can take an arbitrary number of arguments, which includes zero arguments). It is
|
|
764
|
+
very close to a float excepting that each time it is called the returned value
|
|
765
|
+
can change: we now have the possibility of having something like a float which
|
|
766
|
+
varies over time. We like to call such a function a _float getter_, since it can
|
|
767
|
+
be seen as some kind of object on which the only operation we can perform is get
|
|
768
|
+
the value. For instance, we can define a float getter by
|
|
769
|
+
|
|
770
|
+
```liquidsoap
|
|
771
|
+
n = ref(0.)
|
|
772
|
+
def f ()
|
|
773
|
+
n := n() + 1.
|
|
774
|
+
n()
|
|
775
|
+
end
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
Each time we call `f`, by writing `f()` in our script, the resulting float
|
|
779
|
+
will be increased by one compared to the previous one: if we try it in an
|
|
780
|
+
interactive session, we obtain
|
|
781
|
+
|
|
782
|
+
```
|
|
783
|
+
# f();;
|
|
784
|
+
- : float = 1.0
|
|
785
|
+
# f();;
|
|
786
|
+
- : float = 2.0
|
|
787
|
+
# f();;
|
|
788
|
+
- : float = 3.0
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
Since defining such arguments often involves expressions of the form
|
|
792
|
+
|
|
793
|
+
```liquidsoap
|
|
794
|
+
fun () -> e
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
which is somewhat heavy, we have introduced the alternative syntax
|
|
798
|
+
|
|
799
|
+
```liquidsoap
|
|
800
|
+
{e}
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
for it.
|
|
804
|
+
|
|
805
|
+
Finally, in order to simplify things a bit, you will see that the type of
|
|
806
|
+
amplify is actually
|
|
807
|
+
|
|
808
|
+
```
|
|
809
|
+
({float}, source('a)) -> source('a)
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
where the type `{float}` means that both `float` and `() -> float` are accepted,
|
|
813
|
+
so that you can still write constant floats where float getters are
|
|
814
|
+
expected. What we actually call a _getter_ is generally an element of such a
|
|
815
|
+
type, which is either a constant or a function with no argument.
|
|
816
|
+
|
|
817
|
+
In order to work with such types, the standard library often uses the following
|
|
818
|
+
functions:
|
|
819
|
+
|
|
820
|
+
- `getter`, of type `({'a}) -> {'a}`, creates a getter,
|
|
821
|
+
- `getter.get`, of type `({'a}) -> 'a`, retrieves the current value of a getter,
|
|
822
|
+
- `getter.function`, of type `({'a}) -> () -> 'a`, creates a function from a
|
|
823
|
+
getter.
|
|
824
|
+
|
|
825
|
+
### Recursive functions
|
|
826
|
+
|
|
827
|
+
Liquidsoap supports functions which are _recursive_, i.e., that can call
|
|
828
|
+
themselves. For instance, in mathematics, the factorial function on natural
|
|
829
|
+
numbers is defined as fact(n)=1×2×3×...×n, but it can also be defined
|
|
830
|
+
recursively as the function such that fact(0)=1 and fact(n)=n×fact(n-1) when
|
|
831
|
+
n>0: you can easily check by hand that the two functions agree on small values
|
|
832
|
+
of n (and prove that they agree on all values of n). This last formulation has
|
|
833
|
+
the advantage of immediately translating to the following implementation of
|
|
834
|
+
factorial:
|
|
835
|
+
|
|
836
|
+
```liquidsoap
|
|
837
|
+
def rec fact(n) =
|
|
838
|
+
if n == 0 then 1
|
|
839
|
+
else n * fact(n-1) end
|
|
840
|
+
end
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
for which you can check that `fact(5)` gives 120, the expected result. As
|
|
844
|
+
another example, the `list.length` function, which computes the length of a
|
|
845
|
+
list, can be programmed in the following way in Liquidsoap:
|
|
846
|
+
|
|
847
|
+
```liquidsoap
|
|
848
|
+
def rec length(l)
|
|
849
|
+
if l == [] then 0
|
|
850
|
+
else 1 + length(list.tl(l)) end
|
|
851
|
+
end
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
We do not detail much further this trait since it is unlikely to be used for
|
|
855
|
+
radios, but you can see a few occurrences of it in the standard library.
|
|
856
|
+
|
|
857
|
+
## Records and modules
|
|
858
|
+
|
|
859
|
+
### Records
|
|
860
|
+
|
|
861
|
+
Suppose that we want to store and manipulate structured data. For instance, a
|
|
862
|
+
list of songs together with their duration and tempo. One way to store each song
|
|
863
|
+
is as a tuple of type `string * float * float`, but there is a risk of confusion
|
|
864
|
+
between the duration and the length which are both floats, and the situation
|
|
865
|
+
would of course be worse if there were more fields. In order to overcome this,
|
|
866
|
+
one can use a _record_ which is basically the same as a tuple, excepting that
|
|
867
|
+
fields are named. In our case, we can store a song as
|
|
868
|
+
|
|
869
|
+
```liquidsoap
|
|
870
|
+
song = { filename = "song.mp3", duration = 257., bpm = 132. }
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
which is a record with three fields respectively named `filename`, `duration`
|
|
874
|
+
and `bpm`. The type of such a record is
|
|
875
|
+
|
|
876
|
+
```
|
|
877
|
+
{filename : string, duration : float, bpm : float}
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
which indicates the fields and their respective type. In order to access a field
|
|
881
|
+
of a record, we can use the syntax `record.field`. For instance, we can print
|
|
882
|
+
the duration with
|
|
883
|
+
|
|
884
|
+
```liquidsoap
|
|
885
|
+
print("The duration of the song is #{song.duration} seconds")
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
Records can be re-used using _spreads_:
|
|
889
|
+
|
|
890
|
+
```liquidsoap
|
|
891
|
+
song = { filename = "song.mp3", duration = 257., bpm = 132. }
|
|
892
|
+
|
|
893
|
+
# This is a fresh value with all the fields from `song` and
|
|
894
|
+
# a new `id` field:
|
|
895
|
+
song_with_id = { id = 1234, ...song }
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
Alternatively, you can also extend a record using the explicit `v.{...}` syntax:
|
|
899
|
+
|
|
900
|
+
```liquidsoap
|
|
901
|
+
song = { filename = "song.mp3", duration = 257., bpm = 132. }
|
|
902
|
+
|
|
903
|
+
# This is a fresh value with all the fields from `song` and
|
|
904
|
+
# a new `id` field:
|
|
905
|
+
song_with_id = song.{id = 1234}
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
### Modules
|
|
909
|
+
|
|
910
|
+
Records are heavily used in Liquidsoap in order to structure the functions of
|
|
911
|
+
the standard library. We tend to call _module_ a record with only functions, but
|
|
912
|
+
this is really the same as a record. For instance, all the functions related to
|
|
913
|
+
lists are in the `list` module and functions such as `list.hd` are fields of
|
|
914
|
+
this record. For this reason, the `def` construction allows adding
|
|
915
|
+
fields in record. For instance, the definition
|
|
916
|
+
|
|
917
|
+
```liquidsoap
|
|
918
|
+
def list.last(l)
|
|
919
|
+
list.nth(l, list.length(l)-1)
|
|
920
|
+
end
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
adds, in the module `list`, a new field named `last`, which is a function which
|
|
924
|
+
computes the last element of a list. Another shorter syntax to perform
|
|
925
|
+
definitions consists in using the `let` keyword which allows assigning a value
|
|
926
|
+
to a field, so that the previous example can be rewritten as
|
|
927
|
+
|
|
928
|
+
```liquidasoap
|
|
929
|
+
let list.last = fun(l) -> list.nth(l, list.length(l)-1)
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
If you often use the functions of a specific module, the `open` keyword allows
|
|
933
|
+
using its fields without having to prefix them by the module name. For instance,
|
|
934
|
+
in the following example
|
|
935
|
+
|
|
936
|
+
```liquidsoap
|
|
937
|
+
l = [1,2,3]
|
|
938
|
+
open list
|
|
939
|
+
x = nth(l, length(l)-1)
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
the `open list` directive allows directly using the functions in this module: we
|
|
943
|
+
can simply write `nth` and `length` instead of `list.nth` and `list.length`.
|
|
944
|
+
|
|
945
|
+
### Values with fields
|
|
946
|
+
|
|
947
|
+
A unique feature of the Liquidsoap language is that it allows adding fields to
|
|
948
|
+
any value. We also call them _methods_ by analogy with object-oriented
|
|
949
|
+
programming. For instance, we can write
|
|
950
|
+
|
|
951
|
+
```liquidsoap
|
|
952
|
+
song = "test.mp3".{duration = 123., bpm = 120.}
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
which defines a string (`"test.mp3"`) with two methods (`duration` and
|
|
956
|
+
`bpm`). This value has type
|
|
957
|
+
|
|
958
|
+
```
|
|
959
|
+
string.{duration : float, bpm : float}
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
and behaves like a string, e.g. we can concatenate it with other strings:
|
|
963
|
+
|
|
964
|
+
```liquidsoap
|
|
965
|
+
print("the song is " ^ song)
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
but we can also invoke its methods like a record or a module:
|
|
969
|
+
|
|
970
|
+
```liquidsoap
|
|
971
|
+
print("the duration is #{song.duration}")
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
The construction `def replaces` allows changing the main value
|
|
975
|
+
while keeping the methods unchanged, so that
|
|
976
|
+
|
|
977
|
+
```liquidsoap
|
|
978
|
+
def replaces song = "newfile.mp3" end
|
|
979
|
+
print(song)
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
will print
|
|
983
|
+
|
|
984
|
+
```
|
|
985
|
+
"newfile.mp3".{duration = 123., bpm = 120.}
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
(note that the string is modified but not the fields `duration` and `bpm`).
|
|
989
|
+
|
|
990
|
+
### Optional fields
|
|
991
|
+
|
|
992
|
+
During the execution of your script, it can be useful to allow functions
|
|
993
|
+
to receive records that may or may not have a specific field. This can
|
|
994
|
+
be used, for instance, to model optional arguments.
|
|
995
|
+
|
|
996
|
+
This can be achieved in two ways:
|
|
997
|
+
|
|
998
|
+
1. Using the `x.foo ?? default` syntax
|
|
999
|
+
|
|
1000
|
+
Here's an example:
|
|
1001
|
+
|
|
1002
|
+
```liquidsoap
|
|
1003
|
+
# This functions adds 1 to x unless options has a
|
|
1004
|
+
# add field in which case it adds this value
|
|
1005
|
+
def f(x, options) =
|
|
1006
|
+
x + (options.add ?? 1)
|
|
1007
|
+
end
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
The type of this function is:
|
|
1011
|
+
|
|
1012
|
+
```liquidsoap
|
|
1013
|
+
f : (int, 'a.{add? : int}) -> int = <fun>
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
which denotes that the `options` argument can be any value that may or may not have
|
|
1017
|
+
a `add` field. However, if this field is present, it must be of type `int`.
|
|
1018
|
+
|
|
1019
|
+
2. Using the `x?.foo` syntax
|
|
1020
|
+
|
|
1021
|
+
Given a variable `x`, `x?.foo` returns the field value `foo`, if present, or `null`
|
|
1022
|
+
otherwise.
|
|
1023
|
+
|
|
1024
|
+
The `?.` syntax can be chained and works with functions, which make it a very convenient
|
|
1025
|
+
way to drill deep inside nested records:
|
|
1026
|
+
|
|
1027
|
+
```liquidsoap
|
|
1028
|
+
x?.fn(123, "aabb")?.field
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
## Patterns
|
|
1032
|
+
|
|
1033
|
+
As explained earlier, you can use several constructions to extract data from structured values such
|
|
1034
|
+
as `let [x, y] = l` and etc. These constructions are called _patterns_.
|
|
1035
|
+
|
|
1036
|
+
Patterns allows to quickly access values nested deeply inside structured data in a way that remains pretty intuitive when
|
|
1037
|
+
reading the code.
|
|
1038
|
+
|
|
1039
|
+
Patterns are constructed using _variable placeholders_, which are either a variable name such as: `x`, `foo`, etc. or
|
|
1040
|
+
the special symbol `_` for any ignored value.
|
|
1041
|
+
|
|
1042
|
+
### Tuple patterns
|
|
1043
|
+
|
|
1044
|
+
Tuple patterns are pretty straight forward and consist of any sequence of variable captures:
|
|
1045
|
+
|
|
1046
|
+
```liquidsoap
|
|
1047
|
+
let (x, y, _, z) = (123, "aabbcc", true, 3.14)
|
|
1048
|
+
# x = 1, y = "aabbcc", z = 3.14
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
### List patterns
|
|
1052
|
+
|
|
1053
|
+
List patterns are composed of variable placeholders, etc. and spreads of the form:
|
|
1054
|
+
`...<variable placeholder>` such as: `...z`. The spread `..._`
|
|
1055
|
+
can be simply written `...`. See below for an example.
|
|
1056
|
+
|
|
1057
|
+
You can use any combination of:
|
|
1058
|
+
|
|
1059
|
+
- Forward variable names: these capture the first elements of the list.
|
|
1060
|
+
- One spread: this captures any remaining element as a list.
|
|
1061
|
+
- Backward variable names: these capture the last elements of a the list.
|
|
1062
|
+
|
|
1063
|
+
Here are some examples:
|
|
1064
|
+
|
|
1065
|
+
```liquidsoap
|
|
1066
|
+
# Forward capture:
|
|
1067
|
+
let [x, y, z] = [1, 2, 3]
|
|
1068
|
+
# x = 1, y = 2, z = 3
|
|
1069
|
+
|
|
1070
|
+
# Forward capture with spread:
|
|
1071
|
+
let [x, y, ...z] = [1, 2, 3, 4]
|
|
1072
|
+
# x = 1, y = 2, z = [3, 4]
|
|
1073
|
+
|
|
1074
|
+
# Forward capture with ignored values:
|
|
1075
|
+
let [_, x, ...z] = [1, 2, 3, 4]
|
|
1076
|
+
# x = 2, z = [3, 4]
|
|
1077
|
+
|
|
1078
|
+
# Full capture:
|
|
1079
|
+
let [x, y, ...z, t, u, v] = [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
1080
|
+
# x = 1, y = 2, z = [3, 4, 5, 6, 7], t = 7, u = 8, v = 9
|
|
1081
|
+
|
|
1082
|
+
# Backward capture only.
|
|
1083
|
+
let [..., t, u, v] = [1, 2, 3, 4, 5]
|
|
1084
|
+
# t = 3, u = 4, v = 5
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
### Record and module patterns
|
|
1088
|
+
|
|
1089
|
+
Record and module patterns consist of either variable names (not variable capture!), which capture method values
|
|
1090
|
+
or variable names with an associated pattern.
|
|
1091
|
+
|
|
1092
|
+
Record patterns are of the form: `{<captured methods>}` while module patterns are of the form: `<variable capture>.{<captured methods>}`
|
|
1093
|
+
|
|
1094
|
+
Here are some examples:
|
|
1095
|
+
|
|
1096
|
+
```liquidsoap
|
|
1097
|
+
# Record capture
|
|
1098
|
+
let {foo, bar} = {foo = 123, bar = "baz", gni = true}
|
|
1099
|
+
# foo = 123, bar = "baz"
|
|
1100
|
+
|
|
1101
|
+
# Record capture with spread
|
|
1102
|
+
let {foo, bar, ...x} = {foo = 123, bar = "baz", gni = true}
|
|
1103
|
+
# foo = 123, bar = "baz", x = {gni = true}
|
|
1104
|
+
|
|
1105
|
+
# Module capture
|
|
1106
|
+
let v.{foo, bar} = "aabbcc".{foo = 123, bar = "baz", gni = true}
|
|
1107
|
+
# v = "aabbcc", foo = 123, bar = "baz"
|
|
1108
|
+
|
|
1109
|
+
# Module capture with ignored value
|
|
1110
|
+
let _.{foo, bar} = "aabbcc".{foo = 123, bar = "baz", gni = true}
|
|
1111
|
+
# foo = 123, bar = "baz"
|
|
1112
|
+
|
|
1113
|
+
# Record capture with sub-patterns. Same works for module!
|
|
1114
|
+
let {foo = [x, y, z], gni} = {foo = [1, 2, 3], gni = "baz"}
|
|
1115
|
+
# foo = [1, 2, 3], x = 1, y = 2, z = 3, gni = "baz"
|
|
1116
|
+
|
|
1117
|
+
# Record capture with optional methods:
|
|
1118
|
+
let { foo? } = ()
|
|
1119
|
+
# foo = null()
|
|
1120
|
+
|
|
1121
|
+
let { foo? } = { foo = 123 }
|
|
1122
|
+
# foo = 123
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
## Combining patterns
|
|
1126
|
+
|
|
1127
|
+
As seen with record and modules, patterns can be combined at will, for instance, these
|
|
1128
|
+
are all valid patterns:
|
|
1129
|
+
|
|
1130
|
+
```liquidsoap
|
|
1131
|
+
let [{foo}, {gni}, ..., {baz}] = l
|
|
1132
|
+
|
|
1133
|
+
let (_.{ bla = [..., z] }, t, _, u) = x
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
## Advanced values
|
|
1137
|
+
|
|
1138
|
+
In this section, we detail some more advanced values than the ones presented in. You are not expected to be understanding
|
|
1139
|
+
those in details for basic uses of Liquidsoap.
|
|
1140
|
+
|
|
1141
|
+
### Errors
|
|
1142
|
+
|
|
1143
|
+
In the case where a function does not have a sensible result to return, it can raise an
|
|
1144
|
+
_error_. Typically, if we try to take the head of the empty list without
|
|
1145
|
+
specifying a default value (with the optional parameter `default`), an error will be raised.
|
|
1146
|
+
By default, this error will stop the script, which is usually not a desirable
|
|
1147
|
+
behavior. For instance, if you try to run a script containing
|
|
1148
|
+
|
|
1149
|
+
```liquidsoap
|
|
1150
|
+
list.hd([])
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
the program will exit printing
|
|
1154
|
+
|
|
1155
|
+
```
|
|
1156
|
+
Error 14: Uncaught runtime error:
|
|
1157
|
+
type: not_found, message: "no default value for list.hd"
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
This means that the error named "`not_found`" was raised, with a message
|
|
1161
|
+
explaining that the function did not have a reasonable default value of the head
|
|
1162
|
+
to provide.
|
|
1163
|
+
|
|
1164
|
+
In order to avoid this, one can _catch_ exceptions with the syntax
|
|
1165
|
+
|
|
1166
|
+
```liquidsoap
|
|
1167
|
+
try
|
|
1168
|
+
code
|
|
1169
|
+
catch err do
|
|
1170
|
+
handler
|
|
1171
|
+
end
|
|
1172
|
+
```
|
|
1173
|
+
|
|
1174
|
+
This will execute the instructions `code`: if an error is raised at some point
|
|
1175
|
+
during this, the code `handler` is executed, with `err` being the error. For
|
|
1176
|
+
instance, instead of writing
|
|
1177
|
+
|
|
1178
|
+
```liquidsaop
|
|
1179
|
+
l = []
|
|
1180
|
+
x = list.hd(default=0, l)
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
we could equivalently write
|
|
1184
|
+
|
|
1185
|
+
```liquidsoap
|
|
1186
|
+
l = []
|
|
1187
|
+
x =
|
|
1188
|
+
try
|
|
1189
|
+
list.hd(l)
|
|
1190
|
+
catch err do
|
|
1191
|
+
0
|
|
1192
|
+
end
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
The name and message associated to an error can respectively be retrieved using
|
|
1196
|
+
the error `kind` and `message` attributes, e.g. we can write
|
|
1197
|
+
|
|
1198
|
+
```liquidsoap
|
|
1199
|
+
try
|
|
1200
|
+
...
|
|
1201
|
+
catch err do
|
|
1202
|
+
print("the error #{err.kind} was raised")
|
|
1203
|
+
print("the error message is #{err.message}")
|
|
1204
|
+
end
|
|
1205
|
+
```
|
|
1206
|
+
|
|
1207
|
+
Typically, when reading from or writing to a file, errors will be raised when a
|
|
1208
|
+
problem occurs (such as reading from a non-existent file or writing a file in a
|
|
1209
|
+
non-existent directory) and one should always check for those and log the
|
|
1210
|
+
corresponding message:
|
|
1211
|
+
|
|
1212
|
+
```liquidsoap
|
|
1213
|
+
data = "bla"
|
|
1214
|
+
try
|
|
1215
|
+
file.write(data=data, "/non/existent/path")
|
|
1216
|
+
catch err do
|
|
1217
|
+
log.important("Could not write to file: #{error.message(err)}")
|
|
1218
|
+
end
|
|
1219
|
+
```
|
|
1220
|
+
|
|
1221
|
+
Specific errors can be caught with the syntax
|
|
1222
|
+
|
|
1223
|
+
```liquidsoap
|
|
1224
|
+
try
|
|
1225
|
+
...
|
|
1226
|
+
catch err : l do
|
|
1227
|
+
...
|
|
1228
|
+
end
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
where `l` is a list of error names that we want to handle here.
|
|
1232
|
+
|
|
1233
|
+
Errors can be raised from Liquidsoap with the function `error.raise`, which
|
|
1234
|
+
takes as arguments the error to raise and the error message. For instance:
|
|
1235
|
+
|
|
1236
|
+
```liquidsoap
|
|
1237
|
+
error.raise(error.not_found, "we could not find your result")
|
|
1238
|
+
```
|
|
1239
|
+
|
|
1240
|
+
Finally, we should mention that all the errors should be declared in advance
|
|
1241
|
+
with the function `error.register`, which takes as argument the name of the new
|
|
1242
|
+
error to register:
|
|
1243
|
+
|
|
1244
|
+
```liquidsoap
|
|
1245
|
+
myerr = error.register("my_error")
|
|
1246
|
+
error.raise(myerr, "testing my own error")
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
### Nullable values
|
|
1250
|
+
|
|
1251
|
+
It is sometimes useful to have a default value for a type. In Liquidsoap, there
|
|
1252
|
+
is a special value for this, which is called `null`. Given a type `t`, we write
|
|
1253
|
+
`t?` for the type of values which can be either of type `t` or be `null`: such a
|
|
1254
|
+
value is said to be _nullable_. For instance, we could redefine the `list.hd`
|
|
1255
|
+
function in order to return null (instead of raising an error) when the list is
|
|
1256
|
+
empty:
|
|
1257
|
+
|
|
1258
|
+
```liquidsoap
|
|
1259
|
+
def list.hd(l)
|
|
1260
|
+
if l == [] then null() else list.hd(l) end
|
|
1261
|
+
end
|
|
1262
|
+
```
|
|
1263
|
+
|
|
1264
|
+
whose type would be
|
|
1265
|
+
|
|
1266
|
+
```
|
|
1267
|
+
(['a]) -> 'a?
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
since it takes as argument a list whose elements are of type `'a` and returns a
|
|
1271
|
+
list whose elements are `'a` or `null`. As it can be observed above, the null
|
|
1272
|
+
value is created with `null()`.
|
|
1273
|
+
|
|
1274
|
+
In order to use a nullable value, one typically uses the construction `x ?? d`
|
|
1275
|
+
which is the value `x` excepting when it is null, in which case it is the
|
|
1276
|
+
default value `d`. For instance, with the above head function:
|
|
1277
|
+
|
|
1278
|
+
```liquidsoap
|
|
1279
|
+
x = list.hd(l)
|
|
1280
|
+
print("the head is " ^ (x ?? "not defined"))
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
Some other useful functions include
|
|
1284
|
+
|
|
1285
|
+
- `null.defined`: test whether a value is null or not,
|
|
1286
|
+
- `null.get`: obtain the value of a nullable value supposed to be distinct from `null`,
|
|
1287
|
+
- `null.case`: execute a function or another, depending on whether a value is
|
|
1288
|
+
null or not.
|
|
1289
|
+
|
|
1290
|
+
### Runtime evaluation of scripting values
|
|
1291
|
+
|
|
1292
|
+
Similarly to how JSON is [parsed](json.html), you can evaluate string into values at runtime
|
|
1293
|
+
using the `eval` decorator. As with JSON, too, the recommended way to use it is by adding an
|
|
1294
|
+
explicit type annotation:
|
|
1295
|
+
|
|
1296
|
+
```liquidsoap
|
|
1297
|
+
let eval (x: {foo: int, bla: string}) = "{foo = 123, bla = \"gni\"}"
|
|
1298
|
+
print("x.foo = #{x.foo}, x.bla = #{x.bla}")
|
|
1299
|
+
```
|
|
1300
|
+
|
|
1301
|
+
### Including other files
|
|
1302
|
+
|
|
1303
|
+
It is often useful to split your script over multiple files, either because it
|
|
1304
|
+
has become quite large, or because you want to be able to reuse common functions
|
|
1305
|
+
between different scripts. You can include a file `file.liq` in a script by
|
|
1306
|
+
writing
|
|
1307
|
+
|
|
1308
|
+
```liquidsoap
|
|
1309
|
+
%include "file.liq"
|
|
1310
|
+
```
|
|
1311
|
+
|
|
1312
|
+
which will be evaluated as if you had pasted the contents of the file in place
|
|
1313
|
+
of the command.
|
|
1314
|
+
|
|
1315
|
+
For instance, this is useful in order to store passwords out of the main file, in
|
|
1316
|
+
order to avoid risking leaking those when handing the script to some other
|
|
1317
|
+
people. Typically, one would have a file `passwords.liq` defining the passwords
|
|
1318
|
+
in variables, e.g.
|
|
1319
|
+
|
|
1320
|
+
```liquidsoap
|
|
1321
|
+
radio_pass = "secretpassword"
|
|
1322
|
+
```
|
|
1323
|
+
|
|
1324
|
+
and would then use it by including it:
|
|
1325
|
+
|
|
1326
|
+
```liquidsoap
|
|
1327
|
+
%include "passwords.liq"
|
|
1328
|
+
|
|
1329
|
+
radio = ...
|
|
1330
|
+
output.icecast(%mp3, host="localhost", port=8000,
|
|
1331
|
+
password=radio_pass, mount="my-radio.mp3", radio)
|
|
1332
|
+
```
|
|
1333
|
+
|
|
1334
|
+
so that passwords are not shown in the main script.
|
|
1335
|
+
|
|
1336
|
+
### Code comments
|
|
1337
|
+
|
|
1338
|
+
Comments can be added to your code in two ways:
|
|
1339
|
+
|
|
1340
|
+
_Multi-line comments_ are comments that can span multiple lines. They are delimitated
|
|
1341
|
+
by the sequence of characters `#<` at the beginning and `>#` at the end. Anything
|
|
1342
|
+
in between those two sequences is considered code comment.
|
|
1343
|
+
|
|
1344
|
+
Here are some examples:
|
|
1345
|
+
|
|
1346
|
+
Simple multiline comments:
|
|
1347
|
+
|
|
1348
|
+
```liquidsoap
|
|
1349
|
+
#< This is a comment >#
|
|
1350
|
+
```
|
|
1351
|
+
|
|
1352
|
+
Multiline comments can be nested:
|
|
1353
|
+
|
|
1354
|
+
```liquidsoap
|
|
1355
|
+
#<
|
|
1356
|
+
This is a top-level comment
|
|
1357
|
+
|
|
1358
|
+
# This is also a comment
|
|
1359
|
+
|
|
1360
|
+
#<
|
|
1361
|
+
This is a nested code comment
|
|
1362
|
+
>#
|
|
1363
|
+
>#
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
Fancy looking multiline comment
|
|
1367
|
+
|
|
1368
|
+
```liquidsoap
|
|
1369
|
+
#<------- BEGIN CODE COMMENT ----#
|
|
1370
|
+
Comments can also look like this
|
|
1371
|
+
#--------- END CODE COMMENT ----->#
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
_Single-line comments_ are comments that are limited to the current line. Such comments
|
|
1375
|
+
are started with the character `#` without a following `<`. Anything after the initial
|
|
1376
|
+
`#` character and until the end of the line is considered code comment:
|
|
1377
|
+
|
|
1378
|
+
```liquidsoap
|
|
1379
|
+
def f(x) = # This is a single line comment.
|
|
1380
|
+
123
|
|
1381
|
+
end
|
|
1382
|
+
```
|