For an upcoming Android App project of mine I had to parse PLS (or just Playlist) files. I decided to make this a generic Android library ready for re-use. It’s braindead simple to use:
// ... Playlist playlist = PlaylistParser.parse(inputStream); for (Playlist.Track track : playlist.getTracks()) { track.getFile(); track.getTitle(); // ... }
Based on an InputStream (previously retrieved from a file or URL) you’ll get a Playlist class you can ask for tracks. The same works for Strings as well:
// ... Playlist playlist = PlaylistParser.parse(string); for (Playlist.Track track : playlist.getTracks()) { track.getFile(); track.getTitle(); // ... }
That’s all there is to say. It’s available on Github. You can find it on Android Arsenal as well.