First, you'll want to grab the latest MB interface file from here: https://getmusicbee.com/forum/index.php?topic=1972
I use C#, but regardless of whichever you choose, the syntax shouldn't be far off.
To initialize the plugin, you'll need to have the following which you'll find in TestCSharpDll.cs
using System;
using System.Runtime.InteropServices;
namespace MusicBeePlugin
{
public partial class Plugin
{
private MusicBeeApiInterface mbApiInterface;
private PluginInfo about = new PluginInfo();
public PluginInfo Initialise(IntPtr apiInterfacePtr)
{
mbApiInterface = new MusicBeeApiInterface();
mbApiInterface.Initialise(apiInterfacePtr);
about.PluginInfoVersion = PluginInfoVersion;
about.Name = "Plugin Name";
about.Description = "A brief description of what this plugin does";
about.Author = "Author";
about.TargetApplication = "";
about.Type = PluginType.General;
about.VersionMajor = 1;
about.VersionMinor = 0;
about.Revision = 1;
about.MinInterfaceVersion = MinInterfaceVersion;
about.MinApiRevision = MinApiRevision;
about.ReceiveNotifications = (ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents);
about.ConfigurationPanelHeight = 0;
return about;
}
public bool Configure(IntPtr panelHandle)
{
return false;
}
public void ReceiveNotification(string sourceFileUrl, NotificationType type)
{
}
}
}
Tag Retrieval:
mbApiInterface.Library_GetFileTag(string sourceFileUrl, MetaDataType field);
e.g How to retrieve the title tag of the playing track
string title;
string playingTrackUrl = mbApiInterface.NowPlaying_GetFileUrl();
title = mbApiInterface.Library_GetFileTag(playingTrackUrl, MetaDataType.TrackTitle);
Tag Setting:
mbApiInterface.Library_SetFileTag(string sourceFileUrl, MetaDataType field, string value)
e.g How to change the album title of the playing track
mbApiInterface.Library_SetFileTag(playingTrackUrl, MetaDataType.Album, "Greatest c-Row Hits");
mbApiInterface.Library_CommitTagsToFile(playingTrackUrl)
mbApiInterface.MB_RefreshPanels()
Edit:
This is one of the few MusicBee questions I'm more than happy to help someone with on the step-by-step. So feel free to ask everything.
A list of open_source plugins: https://getmusicbee.com/addons/s/?q=open_source&type=2