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

#32 in #playlist

Download history 46/week @ 2024-09-24 24/week @ 2024-10-01 9/week @ 2024-10-08 9/week @ 2024-10-15 8/week @ 2024-10-22 12/week @ 2024-10-29 22/week @ 2024-11-05 9/week @ 2024-11-12 16/week @ 2024-11-19 9/week @ 2024-11-26 14/week @ 2024-12-03 21/week @ 2024-12-10 6/week @ 2024-12-17 30/week @ 2024-12-24 14/week @ 2025-01-07

53 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