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.4k stars 130 forks source link

not getting metadata when using ocaml-metadata instead of taglib #3800

Closed mcfiredrill closed 7 months ago

mcfiredrill commented 7 months ago

Describe the bug Recently upgraded to 2.2.4, was having trouble compiling taglib so I opted for the ocaml-metadata package.

To Reproduce

metadata_repro.liq

set("log.stdout", true)
set("log.file", false)
set("server.telnet",true)

def log_metadata(m) =
  log(string_of(m))
  log("on_track");
  title = m["title"]
  log(string_of(string.length(title)))
  log("quoted title: #{string.quote(title)}")
end

playlist = playlist(mode="randomize", reload=1, reload_mode="rounds", "./metadata_repro_playlist.txt")
playlist.on_track(log_metadata)

output.file(%mp3, "/tmp/metadata_bug.mp3", mksafe(playlist))

metadata_repro_playlist.txt:

https://dongles.streampusher-relay.club/datafruits/AnyConv.com__2022-08-1622.38.06.mp3?1708479245

Expected behavior I expect to see the title metadata, when the metadata is logged but each and every time I run this script, there is no title key in the metadata.

2024/03/10 20:10:26 [lang:3] [("on_air_timestamp", "1710126626.00"), ("kind", "{audio=pcm(stereo)}"), ("decoder", "mad"), ("filename", "/tmp/liq-process4da6ef.mp3"), ("temporary", "true"), ("source", "metadata_repro_playlist_txt"), ("initial_uri", "https://dongles.streampusher-relay.club/datafruits/AnyConv.com__2022-08-1622.38.06.mp3?1708479245"), ("status", "playing"), ("on_air", "2024/03/10 20:10:26"), ("rid", "1")]
2024/03/10 20:10:26 [lang:3] on_track
2024/03/10 20:10:26 [lang.deprecated:2] WARNING: "string_of" is deprecated and will be removed in future version. Please use "string" instead.
2024/03/10 20:10:26 [lang:3] 0
2024/03/10 20:10:26 [lang:3] quoted title: ""

Download this file and see that it does indeed have a title tag set:

$ rp3 AnyConv.com__2022-08-1622.38.06.mp3\?1708479245
title: Krankent Weekly Mix - 02192024
artist:
album:
track number: 0
year: 0
image: [image/jpeg] [915 bytes]
Bitrate: 128
Channels: 2
Sample Rate: 44100
Length: 58.13

Version details

Install method Be sure that liquidsoap is NOT compiled with taglib support to reproduce the bug.

opam install ctypes-foreign metadata mad lame ogg vorbis cry samplerate ocurl liquidsoap -y

2024/03/10 20:08:09 [main:3] Liquidsoap 2.2.4-1+dev
2024/03/10 20:08:09 [main:3] Using: angstrom=0.15.0 bigarray=[distributed with OCaml] bigarray-compat=1.1.0 bigstringa
f=0.9.1 bytes=[distributed with OCaml] camlp-streams camomile.lib=2.0 cry=1.0.2 ctypes=0.22.0 ctypes-foreign=0.22.0 cu
rl=0.9.2 dtools=0.4.5 dune-build-info=3.10.0 dune-private-libs.dune-section=3.10.0 dune-site=3.10.0 dune-site.private=
3.10.0 duppy=0.9.3 fileutils=0.6.4 gen=1.1 integers lame=0.3.7 liquidsoap-lang=2.2.4-1 liquidsoap-lang.console=2.2.4-1
 liquidsoap_builtins liquidsoap_core liquidsoap_lame liquidsoap_mad liquidsoap_ogg liquidsoap_optionals liquidsoap_oss
 liquidsoap_runtime liquidsoap_samplerate liquidsoap_stereotool liquidsoap_vorbis mad=0.5.2 magic-mime=1.3.1 menhirLib
=20230608 metadata=0.2.0 mm=0.8.4 mm.audio=0.8.4 mm.base=0.8.4 mm.image=0.8.4 mm.midi=0.8.4 mm.video=0.8.4 ogg=0.7.4 o
gg.decoder=0.7.4 pcre=7.5.0 samplerate=0.1.6 sedlex=3.2 seq=[distributed with OCaml 4.07 or above] stdlib-shims=0.3.0
stereotool str=[distributed with OCaml] stringext=1.6.0 threads=[distributed with OCaml] threads.posix=[distributed wi
th OCaml] unix=[distributed with OCaml] uri=4.2.0 vorbis=0.8.0 vorbis.decoder=0.8.0
vitoyucepi commented 7 months ago

Hi @mcfiredrill, Do you know that the file is a bit broken?

  1. At the beginning of the file you could see the parts of the http protocol.
  2. Instead of the cover there's a cloudfront html response.
mcfiredrill commented 7 months ago

Instead of the cover there's a cloudfront html response

I have seen this, looks to be a bit more serious than I thought. I'll investigate this.

mcfiredrill commented 7 months ago

Ok yes, there are definitely some corruptions in my mp3s unfortunately. I'm surprised that taglib was able to deal with those.

I'll close but in case the maintainers have any interest in making changes to deal with corrupted files , well I have plenty of samples 😅

toots commented 7 months ago

Thanks for taking the time to reproduce!