Platforms to show: All Mac Windows Linux Cross-Platform

Back to TagLibFileRefMBS class.

TagLibFileRefMBS.Constructor(file as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Tools Plugin 17.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The constructor.

Please point to valid audio file.
May raise error exception.

Uses TagLib, an open source library to read metadata from audio files, e.g. ID3 tags.
Currently it supports both ID3v1 and ID3v2 for MP3 files, Ogg Vorbis comments and ID3 tags and Vorbis comments in FLAC, MPC, Speex, WavPack, TrueAudio, WAV, AIFF, MP4 and ASF files.

TagLibFileRefMBS.CoverArt as Memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Tools Plugin 22.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns cover art.
Example
// for testing a test file on desktop
Var ff as FolderItem = SpecialFolder.Desktop.Child("test.mp3")

Var f As New TagLibFileRefMBS(ff)

// show cover art
Var cover As MemoryBlock = f.CoverArt
If cover <> Nil Then
Var p As Picture = picture.FromData(cover)

If p <> Nil Then
Var pw As New PicWindow
pw.Backdrop = p
End If
End If

Should work for MP3, MP4 and FLAC files.
May return JPEG, PNG, GIF or BMP depending on what the file contains.
Result is nil, if there is no art found.

Some examples using this method:

TagLibFileRefMBS.CoverArts as Memoryblock()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Tools Plugin 24.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns cover arts.

Should work for MP3, MP4 and FLAC files.
May return JPEG, PNG, GIF or BMP depending on what the file contains.
Result is empty array, if there is no art found.

TagLibFileRefMBS.ID3v2Tags as Dictionary   New in 25.0

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Tools Plugin 25.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries all ID3v2 tags as Dictionary.
Example
Var f As New FolderItem("/Users/cs/test.mp3", FolderItem.PathModes.Native)
Var t As New TagLibFileRefMBS(f)
Var d As Dictionary = t.ID3v2Tags
Break // check in debugger

Returns nil, if no ID3v2 tags exist.

TagLibFileRefMBS.Save as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Tools Plugin 17.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves changes to the file.

TagLibFileRefMBS.SetProperties(Dic as Dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Tools Plugin 19.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets audio tags for audio file.
Example
Var file As FolderItem = SpecialFolder.Desktop.Child("test.mp3")

Var tag As New TagLibFileRefMBS(file)
Var dic As Dictionary = tag.Properties

Break // inspect dictionary

dic.Value("ARTIST") = "John Doe"
dic.Value("ALBUM") = Nil // clear this one

tag.SetProperties(dic)

If tag.Save Then
MsgBox "OK"
Else
MsgBox "Failed to save"
End If

Please provide dictionary with new tags.
If tags are nil values, we remove them. If they are text values, we update the text.

The items on this page are in the following plugins: MBS Tools Plugin.


The biggest plugin in space...