-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library and executable for working with playlist files. -- -- 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. -- -- 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
--   
-- -- Playlist Executable Examples: -- --
--   $ playlist urls --format PLS < somefile.pls
--   
--   $ playlist convert --from PLS --to M3U < somefile.pls
--   
@package playlists @version 0.2.0.0 module Text.Playlist -- | A single music file or streaming URL. data Track Track :: Text -> Maybe Text -> Track -- | URL for a file or streaming resource. trackURL :: Track -> Text -- | Optional title. trackTitle :: Track -> Maybe Text -- | A list of Tracks. type Playlist = [Track] -- | Playlist formats. data Format -- | http://en.wikipedia.org/wiki/PLS_(file_format) PLS :: Format -- | M3U and M3U8. http://en.wikipedia.org/wiki/M3U M3U :: Format -- | 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
--   
parsePlaylist :: Format -> ByteString -> Either String Playlist -- | Generate a lazy ByteString containing playlist data from the -- given playlist and in the given format. -- --
--   BL.putStr $ generatePlaylist M3U somePlaylist
--   
generatePlaylist :: Format -> Playlist -> ByteString -- | Try to figure out a file's format from it's file extension. -- --
--   >>> fileNameToFormat "foo.m3u"
--   Just M3U
--   
-- --
--   >>> fileNameToFormat "foo.txt"
--   Nothing
--   
fileNameToFormat :: FilePath -> Maybe Format -- | Given a file name that does not have a file extension, return a file -- name with the appropriate extension included based on the given -- format. -- --
--   >>> appendExtension M3U "foo"
--   "foo.m3u"
--   
appendExtension :: Format -> FilePath -> FilePath