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

Download history 4/week @ 2024-07-22 15/week @ 2024-07-29 11/week @ 2024-08-05 15/week @ 2024-08-12 10/week @ 2024-08-19 9/week @ 2024-08-26 12/week @ 2024-09-02 9/week @ 2024-09-09 8/week @ 2024-09-16 44/week @ 2024-09-23 28/week @ 2024-09-30 7/week @ 2024-10-07 9/week @ 2024-10-14 10/week @ 2024-10-21 7/week @ 2024-10-28 25/week @ 2024-11-04

52 downloads per month
Used in 4 crates

MIT license

16KB
143 lines

pls-rs TravisCI build status AppVeyorCI build status Licence

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