Serial-ATA / lofty-rs

Audio metadata library
Apache License 2.0
187 stars 35 forks source link

Should lofty's warns be debugs? #355

Closed martpie closed 6 months ago

martpie commented 6 months ago

Lofty is quite noisy in std. I am working on a Tauri app, and scanning a few folders and extracting metadata look like the following:

https://github.com/Serial-ATA/lofty-rs/assets/1311607/a0d55282-1a19-4246-bdbc-035c91f6a9af

Shouldn't these be debugs? Or is there a way I can make the crate less noisy? : ]

Serial-ATA commented 6 months ago

The three warnings you're hitting are:

The first is important to let the caller know that the gnre atom, which using an int value, will be upgraded to the ©gen atom which may be surprising otherwise.

The second is a hack for iTunes, that could maybe be a debug message? Not sure how I want to treat that one. It is very much non-standard behavior (iTunes used to write v2 frame IDs in v3 tags).

The third one is letting you know that the duration could be inaccurate. FFmpeg says (pretty much) the same thing when it has to resort to bitrate estimation.

All of these are meant to warn the user that extra steps are being taken to make their tags correct, but they may not be entirely accurate. I did wonder how long it would take before the logs became an issue, though.

Assuming you're using env_logger you can just filter out the modules:

Builder::new().filter(Some("lofty::mpeg::properties"), LevelFilter::Off)
martpie commented 6 months ago

The first is important to let the caller know that the gnre atom, which using an int value, will be upgraded to the ©gen atom which may be surprising otherwise

So the thing is if it fails, we'll keep seing the warning over and over again. For example, I'm using lofty to read the picture of a song, and keep seing this warning over and over.

I am not sure what should be the default behavior there.

I think the logger configuration solution is fair, I'll use that. Thank you!

Serial-ATA commented 6 months ago

So the thing is if it fails, we'll keep seing the warning over and over again.

With the exception of the MPEG warning, they will not be repeated if you rewrite the tag with Lofty (Those warnings indicate that the tag is being altered in memory). Unfortunately, there's no good way to check that a warning happened in the first place.