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

#2033 in Parser implementations

Download history 3/week @ 2023-12-18 5/week @ 2024-01-08 15/week @ 2024-02-12 26/week @ 2024-02-19 73/week @ 2024-02-26 23/week @ 2024-03-04 23/week @ 2024-03-11 34/week @ 2024-03-18 22/week @ 2024-03-25 63/week @ 2024-04-01

147 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

~84KB