savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.43k stars 130 forks source link

say: protocol broken? #4185

Open xogium opened 1 month ago

xogium commented 1 month ago

Description

When liquidsoap 2.3.0 from main runs with source.say_metadata being used, we get the following mess at startup.

2024/10/22 14:22:05 [single:2] Error when starting source single: Lang.Runtime_error { kind: "invalid", msg: "Could not resolve uri: say:Sorry, I do not know what this song title was", pos: [at /var/lib/liquidsoap/.opam/default/share/liquidsoap-lang/libs/request.liq, line 318 char 4 - line 339 char 7, at /var/lib/liquidsoap/.opam/default/share/liquidsoap-lang/libs/request.liq, line 318 char 4 - line 339 char 7, at /var/lib/liquidsoap/.opam/default/share/liquidsoap-lang/libs/request.liq, line 328 char 6 - line 338 char 9, at /var/lib/liquidsoap/.opam/default/share/liquidsoap-lang/libs/request.liq, line 328 char 6 - line 338 char 9, at /var/lib/liquidsoap/.opam/default/share/liquidsoap-lang/libs/request.liq, line 332 char 8 - line 335 char 9, at /var/lib/liquidsoap/.opam/default/share/liquidsoap-lang/libs/request.liq, line 332 char 8 - line 335 char 9, at /var/lib/liquidsoap/.opam/default/share/liquidsoap-lang/libs/request.liq, line 328 char 6 - line 338 char 9, at /var/lib/liquidsoap/.opam/default/share/liquidsoap-lang/libs/request.liq, line 318 char 4 - line 339 char 7] }!

Then the script terminates itself. Looks like say: needs to be updated to conform to ls 2.3.0's new behavior?

Steps to reproduce

create a playlist like so: music = mksafe(playlist("/path/to/directory",reload_mode="watch"))

Then add this: radio = mksafe(source.say_metadata(music))

Output the resulting stream to pulseaudio or icecast, whatever output you choose.

Expected behavior

Liquidsoap should then proceeed to play the stream as requested, inserting song titles / metadata with source.say_metadata as requested.

Liquidsoap version

Liquidsoap rolling-release-v2.3.x-8-gb1ad640+dev                                                                        
Copyright (c) 2003-2024 Savonet team                                                                                    
Liquidsoap is open-source software, released under GNU General Public License.                                          
See <http://liquidsoap.info> for more information.

Liquidsoap build config

* Liquidsoap version  : rolling-release-v2.3.x-8-gb1ad640+dev

 * Compilation options
   - Release build       : false
   - Git SHA             : (none)
   - OCaml version       : 4.14.2
   - OS type             : Unix
   - Libs versions       : angstrom=0.16.1 asetmap=0.8.1 asn1-combinators=0.3.2 astring=0.8.5 base=v0.16.3 base.base_internalhash_types=v0.16.3 base.caml=v0.16.3 base.shadow_stdlib=v0.16.3 base64=3.5.1 bigarray=[distributed with Ocaml] bigarray-compat=1.1.0 bigstringaf=0.10.0 bos=0.2.1 bytes=[distributed with OCaml 4.02 or above] ca-certs=v1.0.0 camlp-streams camomile.lib=2.0 cohttp=5.3.1 cohttp-lwt=5.3.0 cohttp-lwt-unix=5.3.0 conduit=7.1.0 conduit-lwt=7.1.0 conduit-lwt-unix=7.1.0 cry=1.0.3 cstruct=6.2.0 ctypes=0.23.0 ctypes-foreign=0.23.0 curl=0.9.2 digestif.c=1.2.0 domain-name=0.4.0 domain_shims dtools=0.4.5 dune-build-info=3.16.0 dune-private-libs.dune-section=3.16.0 dune-site=3.16.0 dune-site.private=3.16.0 duppy=0.9.4 eqaf=0.10 ffmpeg-av=1.2.0 ffmpeg-avcodec=1.2.0 ffmpeg-avdevice=1.2.0 ffmpeg-avfilter=1.2.0 ffmpeg-avutil=1.2.0 ffmpeg-swresample=1.2.0 ffmpeg-swscale=1.2.0 fileutils=0.6.4 fmt=0.9.0 fpath=0.7.3 gen=1.1 gmap=0.3.0 integers ipaddr=5.6.0 ipaddr-sexp=5.6.0 ipaddr.unix=5.6.0 kdf.hkdf=1.0.0 kdf.pbkdf=1.0.0 lame=0.3.7 liquidsoap-lang=rolling-release-v2.3.x-8-gb1ad640 liquidsoap-lang.console=rolling-release-v2.3.x-8-gb1ad640 liquidsoap_builtins=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_core=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_ffmpeg=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_lame=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_optionals=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_oss=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_prometheus=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_runtime=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_sdl=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_sdl_log_level=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_stdlib=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_stereotool=rolling-release-v2.3.x-8-gb1ad640-dirty liquidsoap_tls=rolling-release-v2.3.x-8-gb1ad640-dirty logs=0.7.0 logs.fmt=0.7.0 logs.lwt=0.7.0 lwt=5.7.0 lwt.unix=5.7.0 macaddr=5.6.0 magic-mime=1.3.1 mem_usage=0.1.1 menhirLib=20240715 metadata=0.3.0 mirage-crypto=1.1.0 mirage-crypto-ec=1.1.0 mirage-crypto-pk=1.1.0 mirage-crypto-rng=1.1.0 mirage-crypto-rng.unix=1.1.0 mm=0.8.5 mm.audio=0.8.5 mm.base=0.8.5 mm.image=0.8.5 mm.midi=0.8.5 mm.video=0.8.5 ocplib-endian ocplib-endian.bigstring ohex ppx_compare.runtime-lib=v0.16.0 ppx_hash.runtime-lib=v0.16.0 ppx_sexp_conv.runtime-lib=v0.16.0 prometheus=1.2 prometheus-app=1.2 ptime=1.2.0 ptime.clock=1.2.0 ptime.clock.os=1.2.0 re=1.12.0 rresult=0.7.0 saturn_lockfree=0.4.1 sedlex=3.2 seq=[distributed with OCaml 4.07 or above] sexplib0=v0.16.0 stdlib-shims=0.3.0 stereotool=rolling-release-v2.3.x-8-gb1ad640-dirty str=[distributed with Ocaml] stringext=1.6.0 threads=[distributed with Ocaml] threads.posix=[internal] tls=1.0.2 tsdl=v1.1.0 tsdl-image=0.5 tsdl-ttf=0.6 unix=[distributed with Ocaml] uri=4.4.0 uri-sexp=4.4.0 uri.services=4.4.0 x509=1.0.4 zarith=1.14
   - architecture        : amd64
   - host                : x86_64-pc-linux-gnu
   - target              : x86_64-pc-linux-gnu
   - system              : linux
   - ocamlopt_cflags     : -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC
   - native_c_compiler   : gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64
   - native_c_libraries  : -lm

 * Configured paths
   - mode              : default
   - standard library  : (set by dune-site)
   - scripted binaries : (set by dune-site)
   - rundir            : (set by dune-site)
   - logdir            : (set by dune-site)
   - user cache        : $HOME/.cache/liquidsoap (override with $LIQ_CACHE_USER_DIR)
   - system cache      : (set by dune-site) (override with $LIQ_CACHE_SYSTEM_DIR)
   - camomile files    : (set by dune-site)

 * Supported input formats
   - MP3               : no (requires mad)
   - AAC               : no (requires faad)
   - Ffmpeg            : yes
   - Flac (native)     : no (requires flac)
   - Flac (ogg)        : no (requires ogg)
   - Opus              : no (requires opus)
   - Speex             : no (requires speex)
   - Theora            : no (requires theora)
   - Vorbis            : no (requires vorbis)
   - WAV/AIFF          : yes (native)

 * Supported output formats
   - FDK-AAC           : no (requires fdkaac)
   - FFmpeg            : yes
   - MP3               : yes
   - MP3 (fixed-point) : no (requires shine)
   - Flac (native)     : no (requires flac)
   - Flac (ogg)        : no (requires ogg)
   - Opus              : no (requires opus)
   - Speex             : no (requires speex)
   - Theora            : no (requires theora)
   - Vorbis            : no (requires vorbis)
   - WAV/AIFF          : yes (native)

 * Tags
   - AAC               : no (requires faad)
   - FFmpeg            : yes
   - FLAC (native)     : no (requires flac)
   - Flac (ogg)        : no (requires ogg)
   - Native decoder    : yes
   - Vorbis            : no (requires vorbis)

 * Input / output
   - ALSA              : no (requires alsa)
   - AO                : no (requires ao)
   - FFmpeg            : yes
   - JACK              : no (requires bjack)
   - OSS               : yes
   - Portaudio         : no (requires portaudio)
   - Pulseaudio        : no (requires pulseaudio)
   - SRT               : no (requires srt)

 * Audio manipulation
   - FFmpeg            : yes
   - LADSPA            : no (requires ladspa)
   - Lilv              : no (requires lilv)
   - Samplerate        : no (requires samplerate)
   - SoundTouch        : no (requires soundtouch)
   - StereoTool        : yes

 * Video manipulation
   - camlimages        : no (requires camlimages)
   - FFmpeg            : yes
   - frei0r            : no (requires frei0r)
   - ImageLib          : no (requires imagelib)
   - SDL               : yes

 * MIDI manipulation
   - DSSI              : no (requires dssi)

 * Visualization
   - GD                : no (requires gd)
   - Graphics          : no (requires graphics)
   - SDL               : yes

 * Additional libraries
   - FFmpeg filters    : yes
   - FFmpeg devices    : yes
   - inotify           : no (requires inotify)
   - irc               : no (requires irc-client-unix)
   - jemalloc          : no (requires jemalloc)
   - lastfm            : no (requires lastfm)
   - lo                : no (requires lo)
   - memtrace          : no (requires memtrace)
   - osc               : no (requires osc-unix)
   - ssl               : no (requires ssl)
   - sqlite3           : no (requires sqlite3)
   - tls               : yes
   - posix-time2       : no (requires posix)
   - windows service   : no (requires winsvc)
   - YAML support      : no (requires yaml)
   - XML playlists     : no (requires xmlplaylist)

 * Monitoring
   - Prometheus        : yes

Installation method

From OPAM

Additional Info

OS is ArchLinux, fully up to date. Opam version is 2.2.1. I've installed liquidsoap by pinning the git repo. Currently using the main branch on commit b1ad6404ef948eef183ef816b11647200336ba86.

toots commented 3 weeks ago

Hi! I have looked at this and here's what I found:

Default implementation for say: in 2.3.x is: say for macos (the say binary) and pico2wave for all other OSes.

I want to clean this up but I believe that this'll have to be for after the release.

Ideally, the append source should not crash the whole script when the appended source fails. More generally, the programmer should have better control of streaming errors.