Comments (9)
The underlying storage abstraction does support in-memory buffers. I'll see how this can be nicely exposed :)
Thank you for the suggestion!
from rust-id3.
Good! I will be releasing this in v1.10 then
from rust-id3.
I have pushed possible implementation in the expose-storage-file branch. Could you please check whether this does what you expect it to do?
from rust-id3.
Yep, it seems to work for me!
However there are some other APIs that do still can't operate in-memory:
Specifically, I was using id3::v1v2::write_to_path
to not only set the id3v2
tag, but also to remove the v1
tag. Internally it uses id3::v1::Tag::remove
, which doesn't seem to use the FileStorage
trait and operates on File
directly..
Then there are all the id3::Tag::write_to_*
APIs, but they seem to be already covered by the Encoder
. Is there any difference between those APIs?
from rust-id3.
I don't know if this helps but I was able to get around this by using a Cursor
use std::io::Cursor;
let curs = Cursor::new(&mut bytes_of_mp3);
// tag is an id3::tag::Tag
tag.write_to(curs, Version::Id3v23).unwrap();
// you can then get the bytes and do what you like with them
let bytes = b.as_slice();
from rust-id3.
@skabber That works to get the raw ID3 tag, but write_to does not take into account any existing data. So if the newly written tag is larger than any existing tag, the data coming after will be partially overwritten!
write_to_path
is aware of the size the tag and trailing data and does not have this problem. But this API does currently not permit writing to in-memory buffers, which is what this issue is about :)
from rust-id3.
@DCNick3 I have updated the patch to introduce a write_to_file
family of functions everywhere. Please check again
from rust-id3.
@skabber That works to get the raw ID3 tag, but write_to does not take into account any existing data. So if the newly written tag is larger than any existing tag, the data coming after will be partially overwritten!
write_to_path
is aware of the size the tag and trailing data and does not have this problem. But this API does currently not permit writing to in-memory buffers, which is what this issue is about :)
Thank you. You may have just exposed a bug in my project :)
from rust-id3.
@DCNick3 I have updated the patch to introduce a
write_to_file
family of functions everywhere. Please check again
Yep, this seems to work nicely!
from rust-id3.
Related Issues (20)
- Tokio support HOT 2
- The slash (`/`) characters in tags are not correctly parsed HOT 2
- In the "Creating a new tag, overwriting any old tag" example, why using both set_album() and add_frame()?? HOT 1
- Support for "comment" tag HOT 1
- Refactor the content.rs file HOT 2
- Consider making `Tag::read_from[...]` functions return `Result<Option<Tag>>` HOT 2
- Writing tags to aiff results in broken files on Apple Silicon HOT 8
- build error below latest stable-1 ? HOT 1
- MSRV Policy & CI HOT 4
- Metadata is not applied to files HOT 6
- Readme Update - running tests depends on installed ffmpeg HOT 1
- Proper attribution HOT 1
- Should duration be calculated manually if TLEN is zero? HOT 2
- Could id3 correctly parse tag generated by audacity on CJK system? HOT 4
- Unified ID3v1/ID3v2 API HOT 6
- v1.1.2 no rules expected / `Flags` build errors HOT 2
- Buffering
- id3::frame::EncapsulatedObject: Encoding is inaccessible HOT 2
- Chapters TOC HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-id3.