lofty-rs icon indicating copy to clipboard operation
lofty-rs copied to clipboard

Add options to suppress errors

Open Serial-ATA opened this issue 3 years ago • 2 comments
trafficstars

Most of the errors out in the wild come from one or two items in an entire tag. Rather than hard error, it'd be nice if there were options to allow for certain (harmless) errors to be discarded.

Some ideas:

  • Discard items causing text decoding errors (very common)
  • Discard audio property reading errors (return the incomplete properties)
  • More?

I'm thinking this could be exposed by Probe and AudioFile, and would look like this:

let parse_options = ParseOptions {
    suppress_text_decode_err: true,
    suppress_audio_property_err: false,
    // ...
};

let file = Probe::open(path)
    .options(parse_options)
    .guess_file_type()?
    .read(true);

// and

let file = Mp3File::read_with_options(reader, true, parse_options)?;

Any thoughts? Would you actually use the feature?

Serial-ATA avatar May 14 '22 23:05 Serial-ATA

For me both - strict and relaxed would be useful - one to check for bugs in library/provided music files and one for reading as much tags as possible.

This reminds me https://github.com/pdf-rs/pdf/issues/129.

qarmin avatar May 16 '22 18:05 qarmin

I really like that idea. I think it could be better than having to set a bunch of options.

Serial-ATA avatar May 17 '22 15:05 Serial-ATA