Copyright | © 2015–2017 Mark Karpov |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <markkarpov92@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Sound.HTagLib
Contents
Description
This module provides a complete high-level interface to TagLib. This is the module you should import to use in your projects.
- getTags :: MonadIO m => FilePath -> TagGetter a -> m a
- getTags' :: MonadIO m => FilePath -> FileType -> TagGetter a -> m a
- titleGetter :: TagGetter Title
- artistGetter :: TagGetter Artist
- albumGetter :: TagGetter Album
- commentGetter :: TagGetter Comment
- genreGetter :: TagGetter Genre
- yearGetter :: TagGetter (Maybe Year)
- trackNumberGetter :: TagGetter (Maybe TrackNumber)
- durationGetter :: TagGetter Duration
- bitRateGetter :: TagGetter BitRate
- sampleRateGetter :: TagGetter SampleRate
- channelsGetter :: TagGetter Channels
- setTags :: MonadIO m => FilePath -> Maybe ID3v2Encoding -> TagSetter -> m ()
- setTags' :: MonadIO m => FilePath -> Maybe ID3v2Encoding -> FileType -> TagSetter -> m ()
- titleSetter :: Title -> TagSetter
- artistSetter :: Artist -> TagSetter
- albumSetter :: Album -> TagSetter
- commentSetter :: Comment -> TagSetter
- genreSetter :: Genre -> TagSetter
- yearSetter :: Maybe Year -> TagSetter
- trackNumberSetter :: Maybe TrackNumber -> TagSetter
- data Title
- mkTitle :: Text -> Title
- unTitle :: Title -> Text
- data Artist
- mkArtist :: Text -> Artist
- unArtist :: Artist -> Text
- data Album
- mkAlbum :: Text -> Album
- unAlbum :: Album -> Text
- data Comment
- mkComment :: Text -> Comment
- unComment :: Comment -> Text
- data Genre
- mkGenre :: Text -> Genre
- unGenre :: Genre -> Text
- data Year
- mkYear :: Int -> Maybe Year
- unYear :: Year -> Int
- data TrackNumber
- mkTrackNumber :: Int -> Maybe TrackNumber
- unTrackNumber :: TrackNumber -> Int
- data Duration
- mkDuration :: Int -> Maybe Duration
- unDuration :: Duration -> Int
- data BitRate
- mkBitRate :: Int -> Maybe BitRate
- unBitRate :: BitRate -> Int
- data SampleRate
- mkSampleRate :: Int -> Maybe SampleRate
- unSampleRate :: SampleRate -> Int
- data Channels
- mkChannels :: Int -> Maybe Channels
- unChannels :: Channels -> Int
- data FileType
- data ID3v2Encoding
- data TagGetter a
- data TagSetter
- data HTagLibException
Getters
getTags path g
will try to read file located at path
and read meta
data of the file using getter g
. Type of file will be guessed from its
extension. If this is not satisfactory and you want to explicitly specify
the file type, see getTags'
variation of this function.
In the case of trouble HTagLibException
will be thrown.
titleGetter :: TagGetter Title #
Getter to retrieve track title.
artistGetter :: TagGetter Artist #
Getter to retrieve track artist.
albumGetter :: TagGetter Album #
Getter to retrieve track album.
commentGetter :: TagGetter Comment #
Getter to retrieve track comment.
genreGetter :: TagGetter Genre #
Getter to retrieve genre of the track.
yearGetter :: TagGetter (Maybe Year) #
Getter to retrieve year to the track (returns Nothing
if the data is
missing).
trackNumberGetter :: TagGetter (Maybe TrackNumber) #
Getter to retrieve track number (returns Nothing
if the data is
missing).
durationGetter :: TagGetter Duration #
Getter to retrieve duration in seconds.
bitRateGetter :: TagGetter BitRate #
Getter to retrieve bit rate.
sampleRateGetter :: TagGetter SampleRate #
Getter to retrieve sample rate.
channelsGetter :: TagGetter Channels #
Getter to retrieve number of channels in audio data.
Setters
Arguments
:: MonadIO m | |
=> FilePath | Path to audio file |
-> Maybe ID3v2Encoding | Encoding for ID3v2 frames |
-> TagSetter | Setter |
-> m () |
Set tags in specified file using the given setter.
In the case of trouble HTagLibException
will be thrown.
Arguments
:: MonadIO m | |
=> FilePath | Path to audio file |
-> Maybe ID3v2Encoding | Encoding for ID3v2 frames |
-> FileType | Type of audio file |
-> TagSetter | Setter |
-> m () |
Similar to setTags
, but you can also specify type of audio file
explicitly (otherwise it's guessed from file extension).
titleSetter :: Title -> TagSetter #
Setter for track title.
artistSetter :: Artist -> TagSetter #
Setter for track artist.
albumSetter :: Album -> TagSetter #
Setter for track album.
commentSetter :: Comment -> TagSetter #
Setter for track comment.
genreSetter :: Genre -> TagSetter #
Setter for track genre.
trackNumberSetter :: Maybe TrackNumber -> TagSetter #
Setter for track number, use Nothing
to clear the field.
Data types
mkTrackNumber :: Int -> Maybe TrackNumber #
Construction of TrackNumber
type, non-positive values result in
Nothing
.
unTrackNumber :: TrackNumber -> Int #
Convert TrackNumber
to Int
.
mkDuration :: Int -> Maybe Duration #
mkSampleRate :: Int -> Maybe SampleRate #
Construction of SampleRate
values, non-positive values result in
Nothing
.
unSampleRate :: SampleRate -> Int #
Convert SampleRate
to Int
.
Number of channels in the audio stream.
mkChannels :: Int -> Maybe Channels #
Types of files TagLib can work with. This may be used to explicitly specify type of file instead of relying on the TagLib's ability to guess type of file from its extension.
data ID3v2Encoding #
Encoding for ID3v2 frames that are written to tags.
Constructors
ID3v2Latin1 | Latin1 |
ID3v2UTF16 | UTF-16 |
ID3v2UTF16BE | UTF-16 big endian |
ID3v2UTF8 | UTF-8 |
Instances
data HTagLibException #
The data type represents exceptions specific to the library.
Constructors
OpeningFailed FilePath | Attempt to open audio file to read its tags failed |
InvalidFile FilePath | File can be opened, but it doesn't contain any information that can be interpreted by the library |
SavingFailed FilePath | Saving failed |
Instances