taglib-api- An FFI layer over TagLib's C bindings

Safe HaskellSafe-Inferred




newtype TagLib a Source

Monad for performing TagLib operations



data TagLibFile Source

Internal representation of an open file

newtype FileId Source

A handle for an open file


FileId Integer 


data File Source

Abstract C Types

data Tag Source

data TagLibEnv Source

A collection of open files, and a generator for unique file ID's

onFilesOpen :: (Map FileId TagLibFile -> Map FileId TagLibFile) -> TagLibEnv -> TagLibEnvSource

Record modify for taglibFilesOpen

onNextId :: (Integer -> Integer) -> TagLibEnv -> TagLibEnvSource

Record modify for taglibNextId

addNewFile :: FileId -> TagLibFile -> TagLib ()Source

Put a new file into the Env

nextId :: TagLib FileIdSource

Get a fresh FileId, maintaining the internal generator

openFilePtrs :: TagLib [Ptr File]Source

Get the list of currently opened files.

fromEnv :: (TagLibEnv -> a) -> TagLib aSource

Call a function requiring the Env

fromFile :: (TagLibFile -> a) -> FileId -> TagLib aSource

Call a function requiring a file. Throws an exception should the FileId not point to a currently open file.

io :: IO a -> TagLib aSource

Embed an IO action in the TagLib context.

freeTagLibStrings :: IO ()Source

Free all the strings that TagLib has allocated. Use only when handling your own memory. Otherwise, taglib will take care of this for you.

removeFile :: FileId -> TagLib ()Source

Remove a file from the Env

runTagLib :: TagLibEnv -> TagLib a -> IO (a, TagLibEnv)Source

Run a TagLib action without managing allocated resources. Reading tags from a file will work regardless of whether cleanupFile is used, but writing tags will not. TagLib's strings must still be freed if a memory leak is to be avoided.

evalTagLib :: TagLibEnv -> TagLib a -> IO aSource

Run an unmanaged TagLib action, discarding the final Env.

closeFile :: FileId -> TagLib ()Source

Save and close a file, in case you want to manage your own memory. TagLib's strings are still freed by taglib.

cleanupFile :: Ptr File -> IO ()Source

The base IO action necessary to deallocate all resources associated with a single file.