Android Playlist File Parser

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s