Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
target
Cargo.lock
fixtures/temp.mp3

.DS_Store
.idea/**
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "taglib"
description = "Rust bindings for TagLib"
version = "1.0.0"
version = "2.0.2"
authors = ["Emmanuele Bassi <ebassi@gnome.org>", "Chris Down <chris@chrisdown.name>"]
license = "MIT"
repository = "https://github.com/ebassi/taglib-rust/"
Expand All @@ -14,11 +14,16 @@ name = "taglib"
path = "src/lib.rs"

[dependencies]
lazy_static = "1.4.0"
libc = "0.2"

[dependencies.taglib-sys]
path = "taglib-sys"
version = "1.0.0"
version = "2.0.0"

[target.'cfg(target_os = "windows")'.dependencies]
codepage = "0.1.1"
windows-sys = { version = "0.52", features = ["Win32_Globalization"] }

[features]
default = []
Expand Down
34 changes: 32 additions & 2 deletions examples/tagreader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ extern crate taglib;
use std::env;

pub fn main() {
const EMPTY: &str = "";

let args: Vec<String> = env::args().collect();

for i in 1..args.len() {
Expand All @@ -23,10 +25,38 @@ pub fn main() {
println!("title - {}", t.title().unwrap_or_default());
println!("artist - {}", t.artist().unwrap_or_default());
println!("album - {}", t.album().unwrap_or_default());
println!("year - {}", t.year().unwrap_or_default());
println!("year - {}", t.year()
.map_or_else(|| EMPTY.to_string(), |t| t.to_string()));
println!("comment - {}", t.comment().unwrap_or_default());
println!("track - {}", t.track().unwrap_or_default());
println!("track - {}", t.track()
.map_or_else(|| EMPTY.to_string(), |t| t.to_string()));
println!("genre - {}", t.genre().unwrap_or_default());

println!("-- File TAG --");
println!("album artist - {}", t.album_artist().unwrap_or_default());
println!("composer - {}", t.composer().unwrap_or_default());
println!("track total - {}", t.track_total()
.map_or_else(|| EMPTY.to_string(), |t| t.to_string()));
println!("disc number - {}", t.disc_number()
.map_or_else(|| EMPTY.to_string(), |t| t.to_string()));
println!("disc total - {}", t.disc_total()
.map_or_else(|| EMPTY.to_string(), |t| t.to_string()));

println!("-- PROPERTY --");
let result_keys = file.keys();
if result_keys.is_ok() {
let keys = result_keys.unwrap();
println!("{} keys.", keys.len());
for key in keys {
println!("{}: {:?}",
key,
file.get_property(&key).unwrap_or_default());
}
} else {
println!("No available properties for {} (error: {:?})",
arg,
result_keys.err().unwrap());
}
}
Err(e) => {
println!("No available tags for {} (error: {:?})", arg, e);
Expand Down
Binary file added fixtures/pic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fixtures/test.flac
Binary file not shown.
Loading