| Safe Haskell | None |
|---|
Text.Playlist
- data Track = Track {
- trackURL :: Text
- trackTitle :: Maybe Text
- type Playlist = [Track]
- data Format
- parsePlaylist :: Format -> ByteString -> Either String Playlist
- generatePlaylist :: Format -> Playlist -> ByteString
Playlist Types
A single music file or streaming URL.
Playlist Formats
Playlist formats.
Constructors
| PLS | |
| M3U | M3U and M3U8. http://en.wikipedia.org/wiki/M3U |
Parsing and Generating
parsePlaylist :: Format -> ByteString -> Either String PlaylistSource
Parse a playlist from a ByteString. Parsing may fail in which
case an error message is returned in Left.
content <- BS.getContents case parsePlaylist M3U content of Left err -> fail $ "failed to parse playlist: " ++ err Right x -> return x
generatePlaylist :: Format -> Playlist -> ByteStringSource
Generate a lazy ByteString containing playlist data from the
given playlist and in the given format.
BL.putStr $ generatePlaylist M3U somePlaylist