-
-
Notifications
You must be signed in to change notification settings - Fork 55
Description
The special case for TRACKNUMBER in VorbisComments is an implicit conversion, and it can alter metadata even if it isn't in the current/total form:
lofty-rs/lofty/src/ogg/read.rs
Lines 171 to 203 in 09a9352
| // Support the case of TRACKNUMBER being equal to current/total | |
| k if k.eq_ignore_ascii_case(b"TRACKNUMBER") => { | |
| match utf8_decode_str(value) { | |
| Ok(value) => { | |
| // try to parse as current/total | |
| let mut value_split = value.splitn(2, '/'); | |
| let track_number: Option<u32> = | |
| value_split.next().and_then(|b| b.parse().ok()); | |
| let track_total: Option<u32> = | |
| value_split.next().and_then(|b| b.parse().ok()); | |
| if let Some(n) = track_number { | |
| tag.set_track(n); | |
| } else { | |
| // Probably some other format, like a vinyl track number (A1, B1, etc.). | |
| // Just leave it up to the caller to deal with. | |
| tag.items | |
| .push((String::from("TRACKNUMBER"), value.to_owned())); | |
| } | |
| if let Some(n) = track_total { | |
| tag.set_track_total(n); | |
| } | |
| }, | |
| Err(e) => { | |
| if parse_mode == ParsingMode::Strict { | |
| return Err(e); | |
| } | |
| log::warn!("Non UTF-8 value found, discarding field {key:?}"); | |
| continue; | |
| }, | |
| } | |
| }, |
Should be skipped if ParseOptions::implicit_conversions is disabled.
Discussed in #539
Originally posted by Methapon2001 August 14, 2025
When I try to get track number and track total, disc and disc total from my FLAC (or other file type) file which should have leading 0, instead I got number with non leading using get or get_string.
I tried with wav file it works as expected.
I tried change probed options(disable implicit conversion / relaxed) and it is not working.
I wonder if this is bug or working as expected.
I tried symphonia it does contains zero leading and also in MusicBrainz Picard.