htaglib-0.1.0: Bindings to TagLib, audio meta-data library

Copyright© 2015 Mark Karpov
LicenseBSD 3 clause
MaintainerMark Karpov <markkarpov@opmbx.org>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Sound.HTagLib.Internal

Contents

Description

Low-level interaction with underlying C API. You don't want to use this, see Sound.HTagLib instead.

Synopsis

Data types

data FileId Source

This is an abstraction representing opened file. Other modules can pass it around and treat it like a black box.

data FileType Source

Types of files TagLib can work with. This may be used to explicitly specify type of file rather than relying on TagLib ability to guess type of file from its extension.

data ID3v2Encoding Source

Encoding for ID3v2 frames that are written to tags.

data HTagLibException Source

The data type represents exceptions specific to the library. The following constructors are defined:

  • OpeningFailed means that attempt to open audio file to read its tags failed.
  • InvalidFile means that file can be opened, but it doesn't contain any information that can be interpreted by the library.
  • SavingFailed is thrown when well… saving failed.

File API

withFile Source

Arguments

:: FilePath

Path to audio file

-> Maybe FileType

Type of file (or it will be guessed)

-> (FileId -> IO a)

Computation depending of FileId

-> IO a

Result value

Open audio file located at specified path, execute some actions given its FileId and then free the file.

saveFile Source

Arguments

:: FilePath

File name to use in exceptions

-> FileId

File identifier

-> IO () 

Save file given its ID. Given FilePath just tells what to put into exception if the action fails, it doesn't specify where to save the file (it's determined by FileId).

Tag API

getTitle :: FileId -> IO Title Source

Get title tag associated with file.

getArtist :: FileId -> IO Artist Source

Get artist tag associated with file.

getAlbum :: FileId -> IO Album Source

Get album tag associated with file.

getComment :: FileId -> IO Comment Source

Get comment tag associated with file.

getGenre :: FileId -> IO Genre Source

Get genre tag associated with file.

getYear :: FileId -> IO (Maybe Year) Source

Get year tag associated with file.

getTrackNumber :: FileId -> IO (Maybe TrackNumber) Source

Get track number associated with file.

setTitle :: Title -> FileId -> IO () Source

Set title of track associated with file.

setArtist :: Artist -> FileId -> IO () Source

Set artist of track associated with file.

setAlbum :: Album -> FileId -> IO () Source

Set album of track associated with file.

setComment :: Comment -> FileId -> IO () Source

Set comment of track associated with file.

setGenre :: Genre -> FileId -> IO () Source

Set genre of track associated with file.

setYear :: Maybe Year -> FileId -> IO () Source

Set year of track associated with file.

setTrackNumber :: Maybe TrackNumber -> FileId -> IO () Source

Set track number of track associated with file.

Audio properties API

getDuration :: FileId -> IO Duration Source

Get duration of track associated with file.

getBitRate :: FileId -> IO BitRate Source

Get bit rate of track associated with file.

getSampleRate :: FileId -> IO SampleRate Source

Get sample rate of track associated with file.

getChannels :: FileId -> IO Channels Source

Get number of channels in track associated with file.

Special convenience ID3v2 functions

id3v2SetEncoding :: ID3v2Encoding -> IO () Source

Set the default encoding for ID3v2 frames that are written to tags.