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
dim ff as FolderItem = SpecialFolder.Desktop.Child("test.mp3")

Dim f As New TagLibFileRefMBS(ff)

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

If p <> Nil Then
Dim 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.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
Dim file As FolderItem = SpecialFolder.Desktop.Child("test.mp3")

Dim tag As New TagLibFileRefMBS(file)
Dim 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...