-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stream picture tags #345
Comments
Thanks for the suggestion. Could you explain a little more what you're looking for, or your use case for this? I'm not sure I entirely understand what's being suggested. I interpret it as turn Lofty into an event-based parser like xml-rs. |
Yeah I guess it is like xml-rs. Use caseFor my music player, I'm passing song artworks into a webview to show them. I'd like to make that faster by only parsing the first picture (skipping the other items), and to stream the picture to the webview while it's being parsed. Screen recordingScreen.Recording.2024-01-23.at.01.23.06.mp4Another thing I didn't think of is the ability to cancel mid-parsing, that would probably be the most significant improvement. |
I have thought about an event-based parser before. Lofty currently doesn't offer much caller control over the parsing process, which I don't like. I'd like Lofty to be a low level crate that people can build abstractions over. This would, however, require a decent sized rewrite of the crate. I'm not opposed to doing that, but there'd need to be a more fleshed out design first. Some initial thoughts:
Since Sketch of what I mean: enum EventKind {
Item(ItemKey),
UnknownItem(String),
}
while let Some(e) = events.next() {
match e {
Ok(EventKind::Item(_key)) => e.skip(),
Ok(EventKind::UnknownItem(key)) => println!("Encountered unknown item: {key}!")
}
}
In APE, for example, we do not have access to the MIME type information ahead of time. We actually read some of the picture data to determine that. Other formats don't have that issue, though. |
Yeah that sounds great, though I understand it would be a lot of work |
Given this will be a rewrite and its something I've wanted to do anyway, I probably won't work on anything new till this is done. I'm going to take a break from Lofty and work on this when I come back. Hopefully I'm able to make this a reality. |
Sounds good! Take all the time you need, appreciate your work :DD |
Want to chime in. It's a pleasure to work with you, @Serial-ATA! |
Summary
The ability to read the picture tags as a stream for improve performance
API design
The text was updated successfully, but these errors were encountered: