liquidsoap icon indicating copy to clipboard operation
liquidsoap copied to clipboard

request.dynamic fetch 2 files on startup.

Open beauchette opened this issue 2 years ago • 3 comments

Describe the bug request.dynamic requests two files on startup. It doesn't work on 2.1.0 and 2.0.3, but it works with 1.4.3.

To Reproduce this script prints two files instead of one on startup:

set("log.file.path", "/opt/liquidsoap/liquidsoap.log")
set("server.telnet", true)
set("server.telnet.port", 1234)
set("server.telnet.bind_addr", "127.0.0.1")
set("init.daemon.pidfile.path","/opt/liquidsoap/liquidsoap.pid")

def req() =
  file = get_process_lines("/opt/liquidsoap/liquidsoap.js")
  print(file)
  result = list.hd( default = "", file)
  request.create(result)
end

s = request.dynamic(prefetch = 1, req)

security = single("/opt/liquidsoap/fallback.ogg")

radio = fallback(track_sensitive = false, [s, security])

output.icecast(%mp3(bitrate=320,id3v2=true),
  host = "localhost", port = 8000, protocol = "http",
  password = "blah", mount = "blah.mp3",
        url="blah", name="blah", description="blah",
  radio)

Expected behavior Only 1 file should be asked of my script.

Version details

  • OS: Debian GNU/Linux 11 (bullseye)
  • Version 2.1.0 has this problem
  • Version 2.0.3 has this problem
  • Version 1.4.3 works fine (but you have to remove prefetch = 1 from request.dynamic)

Install method All versions were installed through opam

beauchette avatar Aug 30 '22 08:08 beauchette

Hi, I have the same problem, when "prefetch" = 0 silence plays, when "prefetch" = 1 2 songs are loaded

script

#!/usr/bin/liquidsoap

%include "../data.cf"

#for print log settings.log.stdout.set(true) settings.log.level.set(3) settings.log.file.path.set("#{main_dir}/#{station}/#{logs}/

radio = request.dynamic(prefetch = 0, get_playlist)

#for sound radio = crossfade(fade_out=3., fade_in=3., duration=5., radio) radio = normalize(radio) radio = mksafe(radio)

output.icecast(%mp3, host = "my.host", port = 8443, user = "#{user}", password = "#{pass}", mount = "#{station}_320", radio ) logs

2022/10/20 11:20:42 >>> LOG START 2022/10/20 11:20:40 [main:3] Liquidsoap 2.1.2 2022/10/20 11:20:40 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.5.0 sedlex=3.0 menhirLib=20220210 curl=0.9.2 uri=4.2.0 dtools=0.4.4 duppy=0.9.2 cry=0.6.7 mm=0.8.1 mad=0.5.2 dynlink=[distributed with Ocaml] lame=0.3.6 ffmpeg=1.1.6 samplerate=0.1.6 taglib=0.3.10 ssl=0.5.12 camomile=1.0.2 2022/10/20 11:20:40 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder. 2022/10/20 11:20:40 [clock:3] Using builtin (low-precision) implementation for latency control 2022/10/20 11:20:42 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz main. 2022/10/20 11:20:42 [frame:3] Video frame size set to: 1280x720 2022/10/20 11:20:42 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples. 2022/10/20 11:20:42 [frame:3] Targeting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks. 2022/10/20 11:20:42 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks. 2022/10/20 11:20:42 [sandbox:3] Sandboxing disabled 2022/10/20 11:20:42 [video.converter:3] Using preferred video converter: ffmpeg. 2022/10/20 11:20:42 [audio.converter:3] Using samplerate converter: libsamplerate. 2022/10/20 11:20:42 [clock.main:3] Streaming loop starts in auto-sync mode 2022/10/20 11:20:42 [clock.main:3] Delegating synchronisation to CPU clock 2022/10/20 11:20:42 [video.text:3] Using native implementation 2022/10/20 11:20:42 [mksafe:3] Switch to safe_blank. 2022/10/20 11:20:42 [416b9d94-4d49-11ed-af4b-93b71599bd52_320:3] Connecting mount 416b9d94-4d49-11ed-af4b-93b71599bd52_320 for user@localhost... 2022/10/20 11:20:42 [416b9d94-4d49-11ed-af4b-93b71599bd52_320:3] Connection setup was successful. script

#!/usr/bin/liquidsoap

%include "../data.cf"

#for print log settings.log.stdout.set(true) settings.log.level.set(3) settings.log.file.path.set("#{main_dir}/#{station}/#{logs}/

radio = request.dynamic(prefetch = 1, get_playlist)

#for sound radio = crossfade(fade_out=3., fade_in=3., duration=5., radio) radio = normalize(radio) radio = mksafe(radio)

output.icecast(%mp3, host = "my.host", port = 8443, user = "#{user}", password = "#{pass}", mount = "#{station}_320", radio ) logs

2022/10/20 11:30:35 >>> LOG START 2022/10/20 11:30:33 [main:3] Liquidsoap 2.1.2 2022/10/20 11:30:33 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.5.0 sedlex=3.0 menhirLib=20220210 curl=0.9.2 uri=4.2.0 dtools=0.4.4 duppy=0.9.2 cry=0.6.7 mm=0.8.1 mad=0.5.2 dynlink=[distributed with Ocaml] lame=0.3.6 ffmpeg=1.1.6 samplerate=0.1.6 taglib=0.3.10 ssl=0.5.12 camomile=1.0.2 2022/10/20 11:30:33 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder. 2022/10/20 11:30:33 [clock:3] Using builtin (low-precision) implementation for latency control 2022/10/20 11:30:35 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz main. 2022/10/20 11:30:35 [frame:3] Video frame size set to: 1280x720 2022/10/20 11:30:35 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples. 2022/10/20 11:30:35 [frame:3] Targeting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks. 2022/10/20 11:30:35 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks. 2022/10/20 11:30:35 [sandbox:3] Sandboxing disabled 2022/10/20 11:30:35 [video.converter:3] Using preferred video converter: ffmpeg. 2022/10/20 11:30:35 [audio.converter:3] Using samplerate converter: libsamplerate. 2022/10/20 11:30:35 [video.text:3] Using native implementation 2022/10/20 11:30:35 [clock.main:3] Streaming loop starts in auto-sync mode 2022/10/20 11:30:35 [clock.main:3] Delegating synchronisation to CPU clock 2022/10/20 11:30:35 [lang:3] next song: https://my.other.host/e0d26fd6-493c-11ed-ae5d-93b71599bd52/a035d2fc-495e-11ed-ae67-93b71599bd52.mp3 2022/10/20 11:30:35 [mksafe:3] Switch to safe_blank. 2022/10/20 11:30:35 [416b9d94-4d49-11ed-af4b-93b71599bd52_320:3] Connecting mount 416b9d94-4d49-11ed-af4b-93b71599bd52_320 for user@host... 2022/10/20 11:30:35 [416b9d94-4d49-11ed-af4b-93b71599bd52_320:3] Connection setup was successful. 2022/10/20 11:30:36 [request.dynamic_0:3] Prepared "/tmp/liq-processaf2afb.mp3" (RID 0). 2022/10/20 11:30:36 [mksafe:3] Switch to amplify_1 with transition. 2022/10/20 11:30:36 [lang:3] next song: https://my.other.host//e0d26fd6-493c-11ed-ae5d-93b71599bd52/a154f6f4-495e-11ed-ae67-93b71599bd52.mp3

CatVahe avatar Oct 20 '22 11:10 CatVahe

@toots

CatVahe avatar Oct 20 '22 11:10 CatVahe

I just moved my setup to another server with the same problem. Installed last liquidsoap from opam. And, at startup, request.dynamic still "asks" two times from request.dynamic. So I went back to 1.4.3 (didn't try 1.4.4 though), which is the last version where request.dynamic asked for only one file on startup.

beauchette avatar Jul 12 '23 20:07 beauchette