Taglib.File.open_file first uses Unix.stat to check that the file
exists.  If the file cannot be opened Not_found is raised.  The code
then invokes open_file which is caml_taglib_file_new.

I am walking my music library on all files.  When I use the file_type
Autodetect on a file like "cover.jpg", caml_taglib_file_new raises
Not_found due to the caml_taglib_file_new code

  if (type == get_var(Autodetect))
      f = FileRef::create(filename);
  else ��
which is followed by

  if (f == NULL)
      caml_raise_constant(*caml_named_value("taglib_exn_not_found"));

Although the exception Not_found is easy enough to catch I don't like
how it reads.  We already know that the files exists and so I would
prefer Invalid_file as "cover.jpg" is not an audio file.

The enhancement I am requesting is to change taglib_stubs.cc from

  if (type == get_var(Autodetect))
     f = FileRef::create(filename);
  else if (type == get_var(Mpeg))

to

  if (type == get_var(Autodetect)) {
    f = FileRef::create(filename);
    caml_raise_constant(*caml_named_value("taglib_exn_invalid_file"));
  } else if (type == get_var(Mpeg))

Thank you very much for providing ocaml-taglib.  One of the these days
I should get around to using LiquidSoap instead of "rolling my own".

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to