Why
To learn rust!
Usage
This is ID3 read and write library.
- Add dependency
- Reding: How to read
ID3information - Writing: How to write
ID3information - Rewrite: How to rewrite all
ID3information to version 4 - Getting information of a frame body without property name.
other usecases See tests.
Add dependency
This can be used by adding rtag to your dependencies in your project's Cargo.toml
[]
= "0.3.1"
and this to your crate root:
extern crate rtag;
Reding: How to read ID3 information
To read a ID3 metadata, you use a MetadataReader and a Unit enum.
and the MetadataReader is implementing the std::iter::Iterator trait,
you can use filter, map, fold.. and so on.
Example
// read a frame1
for m in new.unwrap
// filter a frame v3 having `compression flag`
let mut i = new.unwrap.filter;
// fold a frame v2
let new_data = new
.unwrap
.fold;
Writing: How to write ID3 information
To write a ID3 metadata, you pass FrameHeader and FrameBody to MetadataWriter via std::vec::Vec.
Example
let new_data = new
.unwrap
.fold;
let _ = new.unwrap.write;
Rewrite: How to rewrite a ID3 information to version 4
To rewrite all the frames to version 4, it is same to above example but second parameter is true.
Note: the frame v1 information is ignored and some frames that are ignored.
- In 2.2 'CRM', 'PIC'.
- In 2.3 'EQUA', 'IPLS', 'RVAD', 'TDAT', 'TIME', 'TORY', 'TRDA', 'TSIZ', 'TYER'
// collect frames having version 2
let frames = new.unwrap.;
// rewrite to version 4
let _ = new.unwrap.write;
// read a version 4
for unit in new.unwrap
Getting information of a frame body without property name.
To read value of frame without property name, FrameBody support to_map and inside.
Example
for unit in new.unwrap