Library and executable for working with playlist files.

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed and maintained by Peter Jones

Haskell Playlists Library and Tool

Playlists is a library for working with media playlist files. The original motivation for the library was extracting URLs for streaming radio stations that use PLS and M3U playlist files.

The package also includes an executable that can dump the URLs from a playlist file and convert between playlist file formats.

Supported Formats

  • [PLS] []
  • [M3U and M3U8] [M3U]

Future Plans

Some playlist files can be really big. I plan on adding support for incremental parsing and generating via io-streams at some point in the future.

Library Example

import qualified Data.ByteString as BS
import Text.Playlist

readPlaylist :: Format -> IO Playlist
readPlaylist fmt = do
  content <- BS.getContents
  case parsePlaylist fmt content of
    Left err -> fail $ "failed to parse playlist on stdin: " ++ err
    Right x  -> return x

Executable Example

$ playlist urls --format PLS < somefile.pls

$ playlist convert --from PLS --to M3U < somefile.pls


Version (December 1, 2017)

  • Add support for track length (thanks to Catherine Galkina)

  • Widen dependency versions to latest available.

Version (February 5, 2017)

  • Remove redundant constraints as reported by GHC 8.X.

  • Widen dependency versions to latest available.

Version (November 21, 2016)

  • Added the resolve function. If you have a playlist that contains references to remote playlists, this new function will recursively download and process playlists until it has a flat playlist with no further remote references.

    See the playlists-http package for an example of using the resolve function.

  • Added the parserForFormat function which directly exposes the attoparsec parser for each playlist type. This should make it easy to write space efficient functions that parse playlists.

Version (January 24, 2015)

  • Update dependencies to recent versions (thanks to Wieland Hoffmann).
comments powered byDisqus