Skip to content

nbonamy/taglib_ffi

Repository files navigation

taglib_ffi


Only built/tested on MacOS for now!


A dart wrapper of TagLib.

Supported formats:

  • MP3
  • FLAC
  • MP4 (aka. M4A, aka. ALAC)

Supported fiunctionalities:

  • Read/Update/Delete tags (see below)
  • Read/Update/Delete artwork
  • Read/Update/Delete lyrics

Dependencies

MacOS

brew install cmake
brew install taglib

Setup

MacOS

HOMEBREW_PREFIX variable needs to be defined:

export HOMEBREW_PREFIX="$(brew --prefix)" 

Usage

Add as a pubspec.yaml dependency.

To read/write tags:

TagLib tagLib = TagLib();
Tags tags = tagLib.getAudioTags(filename);
if (tags.valid) {
  ...
}
// update tags
tagLib.setAudioTag(filename, tags);

To display artwork:

TagLib tagLib = TagLib();
FutureBuilder(
  future: tagLib.getArtworkBytes(filename),
  builder: (_, snapshot) => Image.memory(snapshot.data)
)

To read/write lyrics:

TagLib tagLib = TagLib();
String lyrics = tagLib.getLyrics(filename);
// update lyrics
tagLib.setLyrics(filename, lyrics);

Tests

make tests

Supported tags

  • Title
  • Album
  • Artist (Album Artist)
  • Performer
  • Composer
  • Genre
  • Copyright
  • Comment
  • Year
  • Compilation
  • Volume/Album Index
  • Volume/Album Count
  • Track Index
  • Track Count