Crate ape

Source
Expand description

A library for reading and writing APEv2 tags.

An APE tag is a tag used to add metadata (title, artist, album, etc…) to digital audio files.

Read the specification for more information.

§Examples

§Creating a tag

use ape::{Item, ItemType, Tag, write_to_path};

let mut tag = Tag::new();
let item = Item::new("artist", ItemType::Text, "Artist Name").unwrap();
tag.set_item(item);
write_to_path(&tag, "path/to/file").unwrap();

§Reading a tag

use ape::read_from_path;

let tag = read_from_path("path/to/file").unwrap();
let item = tag.item("artist").unwrap();
let value: &str = item.try_into().unwrap();
println!("{}", value);

§Updating a tag

use ape::{Item, ItemType, write_to_path, read_from_path};

let path = "path/to/file";
let mut tag = read_from_path(path).unwrap();
let item = Item::new("album", ItemType::Text, "Album Name").unwrap();
tag.set_item(item);
tag.remove_items("cover");
write_to_path(&tag, path).unwrap();

§Deleting a tag

use ape::remove_from_path;

remove_from_path("path/to/file").unwrap();

Structs§

Item
Represents an APE Tag Item.
Tag
An APE Tag containing APE Tag Items.

Enums§

Error
Describes all errors that may occur.
ItemType
Represents an APE Tag Item Type (bit 2..1)

Functions§

read_from
Attempts to read an APE tag from a reader
read_from_path
Attempts to read an APE tag from the file at the specified path.
remove_from
Attempts to remove an APE tag from a File
remove_from_path
Attempts to remove APE tag from the file at the specified path.
write_to
Attempts to write the APE tag to a File.
write_to_path
Attempts to write the APE tag to the file at the specified path.

Type Aliases§

Result
A specialized Result type for metadata operations.