4 releases
Uses old Rust 2015
0.2.2 | Aug 7, 2019 |
---|---|
0.2.1 | Aug 2, 2019 |
0.2.0 | Mar 5, 2017 |
0.1.0 | Mar 5, 2017 |
#30 in #playlist
52 downloads per month
Used in 4 crates
16KB
143 lines
pls-rs
Rust crate for parsing and writing the PLS playlist format
Documentation
lib.rs
:
Parser and writer for the PLS
playlist format.
Examples
Reading PLS':
assert_eq!(pls::parse(&mut &b"[playlist]\n\
File1=Track 1.mp3\n\
Title1=Unknown Artist - Track 1\n\
\n\
File2=Track 2.mp3\n\
Length2=420\n\
\n\
File3=Track 3.mp3\n\
Length3=-1\n\
\n\
NumberOfEntries=3\n"[..]).unwrap(),
vec![PlaylistElement {
path: "Track 1.mp3".to_string(),
title: Some("Unknown Artist - Track 1".to_string()),
len: ElementLength::Unknown,
},
PlaylistElement {
path: "Track 2.mp3".to_string(),
title: None,
len: ElementLength::Seconds(420),
},
PlaylistElement {
path: "Track 3.mp3".to_string(),
title: None,
len: ElementLength::Unknown,
}]);
Writing PLS':
let mut buf = Vec::new();
pls::write(&[PlaylistElement {
path: "Track 1.mp3".to_string(),
title: Some("Unknown Artist - Track 1".to_string()),
len: ElementLength::Unknown,
},
PlaylistElement {
path: "Track 2.mp3".to_string(),
title: None,
len: ElementLength::Seconds(420),
},
PlaylistElement {
path: "Track 3.mp3".to_string(),
title: None,
len: ElementLength::Unknown,
}],
&mut buf).unwrap();
assert_eq!(String::from_utf8(buf).unwrap(),
"[playlist]\n\
File1=Track 1.mp3\n\
Title1=Unknown Artist - Track 1\n\
\n\
File2=Track 2.mp3\n\
Length2=420\n\
\n\
File3=Track 3.mp3\n\
\n\
NumberOfEntries=3\n\
Version=2\n")
Dependencies
~87KB