Platforms to show: All Mac Windows Linux Cross-Platform

/Tools/LibTag/TagReader


Required plugins for this example: MBS Tools Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/LibTag/TagReader

This example is the version from Sun, 5th Nov 2022.

Project "TagReader.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer) dim v as Variant = me.RowTag(row) if v isa TagLibAudioPropertiesMBS then // audio properties dim a as TagLibAudioPropertiesMBS = v List.AddRow "Bitrate", str(a.Bitrate) List.AddRow "Channels", str(a.Channels) List.AddRow "Length", str(a.Length) List.AddRow "SampleRate", str(a.SampleRate) elseif v isa Dictionary then // property map dim d as Dictionary = v for each key as Variant in d.keys dim val as Variant = d.Value(key) List.AddRow key, val next elseif v isa TagLibTagMBS then // standard dim t as TagLibTagMBS = v List.AddRow "Album", t.Album List.AddRow "Artist", t.Artist List.AddRow "Comment", t.Comment List.AddRow "Genre", t.Genre List.AddRow "Title", t.Title if t.Track <> 0 then List.AddRow "Track", str(t.Track) end if if t.Year <> 0 then List.AddRow "Year", str(t.Year) end if end if End EventHandler
End Control
Control OpenButton Inherits PushButton
ControlInstance OpenButton Inherits PushButton
EventHandler Sub Action() // for testing a test file on desktop dim ff as FolderItem = SpecialFolder.Desktop.Child("test.mp3") if not ff.Exists then // let user pick one ff = GetOpenFolderItem(FileTypes1.All) end if if ff = nil then Return // read it List.DeleteAllRows 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 // show audio properties dim a as TagLibAudioPropertiesMBS = f.audioProperties dim t as TagLibTagMBS = f.tags List.AddRow "File", ff.name if a <> nil then List.AddFolder "Audio Properties" List.RowTag(List.LastIndex) = a List.Expanded(List.LastIndex) = true end if if t <> nil then List.AddFolder "Standard Tags" List.RowTag(List.LastIndex) = t List.Expanded(List.LastIndex) = true List.AddFolder "Tags" List.RowTag(List.LastIndex) = t.Tags List.AddFolder "Properties" List.RowTag(List.LastIndex) = f.Properties else MsgBox "Failed to read file." end if End EventHandler
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
FileTypes1
Filetype audio/mp3
Filetype audio/mp4
Filetype audio/aiff
Filetype audio/wav
Filetype audio/x-m4a
Filetype audio/x-m4a
End FileTypes1
Class PicWindow Inherits Window
End Class
End Project

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


The biggest plugin in space...