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.36k stars 121 forks source link

output.file(%flac generates empty files after re-opening #3316

Closed martinkirch closed 11 months ago

martinkirch commented 11 months ago

After installing v2.2.0 from the debian package, this portion of my script does not work correctly:

output.file(%flac,
        {time.string("home/martin/pige/%Y-%m-%d/%Hh%M_%S.flac")},
        grille_avec_jingle,
        reopen_when = {0m}
)

Liquidsoap does write the first file as expected, but after re-opening generated files are empty:

$ ls -l
-rw-rw-rw- 1 martin martin 290787121 13 août  18:00 17h17_02.flac
-rw-rw-rw- 1 martin martin     10271 13 août  19:00 18h00_00.flac
-rw-rw-rw- 1 martin martin         0 13 août  19:00 19h00_00.flac

switching to %wav or %mp3 works fine.

toots commented 11 months ago

Thank you for reporting this issue. Could you try the following script? It fails to reproduce the issue here:

log.level := 4

s = sine()

output.file(%flac,
  reopen_delay=2.,
  reopen_when={00s or 15s or 30s or 45s},
  {time.string("/tmp/flac/%Y-%m-%d/%Hh%M_%S.flac")},
  s)
toots commented 11 months ago

My bad I was testing with the wrong branch. I have a fix coming!

martinkirch commented 11 months ago

Hello, Thanks for that quick fix. However after checking out the rolling-release-v2.2.x branch, it fails to compile:

#=== ERROR while compiling liquidsoap-core.2.2.1 ==============================#
# context     2.1.2 | linux/x86_64 | ocaml-base-compiler.5.0.0 | pinned(git+file:///home/martin/liquidsoap#HEAD#a08e83d4)
# path        ~/.opam/5.0.0/.opam-switch/build/liquidsoap-core.2.2.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p liquidsoap-core -j 3 --promote-install-files=false @install
# exit-code   1
# env-file    ~/.opam/log/liquidsoap-core-689778-3ce302.env
# output-file ~/.opam/log/liquidsoap-core-689778-3ce302.out
### output ###
# (cd _build/default && /home/martin/.opam/5.0.0/bin/ocamlc.opt -w -40 -g -bin-annot -I src/core/.liquidsoap_ogg_flac.objs/byte -I /home/martin/.opam/5.0.0/lib/angstrom -I /home/martin/.opam/5.0.0/lib/bigstringaf -I /home/martin/.opam/5.0.0/lib/bytes -I /home/martin/.opam/5.0.0/lib/camlp-streams -I /home/martin/.opam/5.0.0/lib/camomile/lib -I /home/martin/.opam/5.0.0/lib/cry -I /home/martin/.op[...]
# File "src/core/decoder/ogg_flac_duration.ml", line 47, characters 24-54:
# 47 |         let callbacks = Flac_ogg.Decoder.get_callbacks os (fun _ -> ()) in
#                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Error: This function has type
#          Flac.Decoder.write -> Flac_ogg.Decoder.ogg Flac.Decoder.callbacks
#        It is applied to too many arguments; maybe you forgot a `;'.

I'm surprised because your branch passed the CI ; am I using something deprecated ?