Safe Haskell | None |
---|
- 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.
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