flactag-d ~main
Library for reading and writing FLAC tags.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
flactag.d
Pure D library for reading and writing FLAC tags. It is stable and fairly optimised, but it could do with a little clean-up.
Set-up
import flactag.flactag : FlacTag;
import flactag.objects : FlacTags, FlacPicture, FlacPictureType;
FlacTag flac = new FlacTag(`G:\track.flac`);
Opening a FLAC file. It is automatically closed when the FlacTag object goes out of scope.
Examples
Reading tags
FlacTags tags = flac.readTags();
string album = tags.getFirst("ALBUM");
string title = tags.getFirst("TITLE");
// FLAC allows multiple of the same field names.
string[] comments = tags.getAll("COMMENT");
Writing tags
FlacTags tags;
tags.set("ALBUM", "my album");
tags.setMany("COMMENT", ["com one", "com two"]);
flac.writeTags(tags);
Extracting pics
FlacTags tags = flac.readTags();
FlacPicture[] pics = tags.getAllPictures();
foreach (idx, pic; pics)
{
auto fname = format("%02d.jpg", idx + 1);
pic.writeToFile(fname);
}
Writing a pic
FlacTags tags;
auto coverData = cast(ubyte[]) read("cover.jpg");
auto pic = FlacPicture(
mimeType: "image/jpeg",
type: FlacPictureType.FrontCover,
data: coverData,
description: "my desc"
);
tags.addPicture(pic);
flac.writeTags(tags);
Note
version(Windows)
{
import core.sys.windows.windows : GetConsoleOutputCP, SetConsoleOutputCP;
}
version(Windows)
{
auto ccp = GetConsoleOutputCP();
SetConsoleOutputCP(65001);
scope(exit) SetConsoleOutputCP(ccp);
}
D doesn't handle this so when printing Japanese/Korean etc tags on Windows in Command Prompt, you have to change your code page.
Disclaimer
flactag.d is stable, but you should still back up your tracks just in case.
- ~main released an hour ago
- Sorrow446/flactag.d
- github.com/Sorrow446/flactag.d
- MIT
- Authors:
- Dependencies:
- none
- Versions:
-
Show all 2 versions0.1.0 2026-Feb-07 ~main 2026-Feb-07 - Download Stats:
-
-
3 downloads today
-
3 downloads this week
-
3 downloads this month
-
3 downloads total
-
- Score:
- 0.0
- Short URL:
- flactag-d.dub.pm