Author Topic: MusicBee API  (Read 189450 times)

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31045
I've created the first version of an API that enables plugin developers to access information held in MusicBee and to control MusicBee.
Initially the API is focussed on enabling your plugin to be notified of player events, retrieve tag data, and to control the player. Over time I will add APIs to stream music data, control GUI aspects so you can create new views or possibly entirely skin MusicBee.

I would appreciate anyone building a plugin to let me know so I know whats coming down the line so I dont end up duplicating anything, or so I can prioritise adding new API calls.

Get the latest MusicBee beta from the downloads topic
http://getmusicbee.com/forum/index.php?board=6.0

All dlls need to be named MB_*.dll and placed in the Plugins folder where MB is installed.
If using C# or VB.NET, you need to target .NET 4.0 client profile and for all interfaces note that MusicBee runs in 32-bit mode on 64-bit machines

API interface and examples for v2.5:
C# source
http://www.mediafire.com/download/68vyibca4d80a7p/C#_Source.zip
VB.NET source
http://www.mediafire.com/download/2b7xx3orh0c9x07/VB_Source.zip
C++ source - this is no longer being updated with new API methods - contact me if you would need to use the C++ API
http://www.mediafire.com/?i53gtmmoq41rsac

API interface and examples for v3.0:
C# source
http://www.mediafire.com/download/5x2s51afgiq9y3i/C#_Source3.0.zip
VB.NET source
http://www.mediafire.com/download/acgyipk8f8z8jhh/VB_Source3.0.zip


API interface and examples for v3.1+:
C# source
http://www.mediafire.com/file/1cio56q16btp5p7/C%23_Source3.1.zip
VB.NET source
http://www.mediafire.com/file/v9207ekc5h8xojx/VB_Source3.1.zip
C++ source - this API is very old and missing many new API methods - contact me if you would need to use the C++ API
http://www.mediafire.com/?i53gtmmoq41rsac

The API interface is backwards compatible, so you are not required to update your plugin every time the API is updated
Last Edit: November 23, 2019, 04:47:53 PM by Steven

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31045
i've also created a .NET interface with C# and VB.NET code samples. See the first post for links

For the C++ interface, I needed to change the Initialise function to take the musicbee api as a pointer, so please get the latest source code, replace MusicBeeInterface_1_0.h, and edit the Initialise function:
PluginInfo* Initialise(MusicBeeApiInterface* apiInterface)

You will also need the updated MusicBee.exe

I created 2 new API calls:
- NowPlaying_GetFileProperty(FilePropertyType type)
- NowPlaying_GetFileTag(MetaDataType type)

which differ from the Library_ API in that the files dont need to be in the library eg. the current playing track from a radio stream

Going forward, any new API calls will be versioned and wont require you to update your plugin
Last Edit: September 29, 2010, 10:30:27 PM by Steven

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31045
The latest 1.2 beta on the downloads topic now supports artwork and lyric plugins.
Also supports an additional notification type enumeration
            PluginStartup = 0,          // notification sent after successful initialisation for an enabled plugin

Last Edit: October 12, 2010, 05:07:01 PM by Steven

Londinium

  • Jr. Member
  • **
  • Posts: 21
I have no time to check that right now but as it's relative to my interests, I add it to my TODO ;-)

thegreyspot

  • Full Member
  • ***
  • Posts: 212
Would you be ok if I copy this to the wiki?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31045

stas

  • Jr. Member
  • **
  • Posts: 54
I totally like the idea of making API.

What about me, the only thing I want to do with the API - to create my own simplififed skin for listening with ability of switching to the full skin (MusicBee has a lot of functions, but many of them are not for everyday use).
The problem is the entry level. Markup languages like xml are enough for creating skins and also much simplier than C++ or VB. So I hope that knowledge of xml would be enough for making skins.

ferongr

  • Full Member
  • ***
  • Posts: 193
I totally like the idea of making API.

What about me, the only thing I want to do with the API - to create my own simplififed skin for listening with ability of switching to the full skin (MusicBee has a lot of functions, but many of them are not for everyday use).
The problem is the entry level. Markup languages like xml are enough for creating skins and also much simplier than C++ or VB. So I hope that knowledge of xml would be enough for making skins.

Lookup "API on Wikipedia. In short, an API allows third party applications to interchange data and interact with Musicbee. A skin... is just a skin. Normally, it doesn't change how the application works. While due to a lack of time I haven't gone through the API, if it's complete it could be easy to whip out a simple GUI that does basic operations (I don't know about library querying). But then, you could just use mini mode.

Some people are into sidebar apps or "Gadgets" for controlling their music applications, but personally I think they're unnecessary and not a "correct" way to control a music app in the background, since you normally have windows tiled or maximized over them.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31045
the skins are already implemented as XML. However both the skin XML and also the MusicBee API are quite basic at the moment eg. the skin XML has very few positioning and sizing attributes. Over time, probably more so next year I will add to them both.
But with the API in particular if anyone wants to achieve some sort of plugin with it and it is missing the required API calls let me know and I will give priority to it.

stas

  • Jr. Member
  • **
  • Posts: 54
Yes, I miss positioning and sizing abilities.
Ideally xml-skinning should looks like this http://dev.winamp.com/wiki/Modern_Skin:_Intro

Londinium

  • Jr. Member
  • **
  • Posts: 21
Hello,

Is there any way via the actual API methods to read through the library?
I guess the database is in SQLite 3 and it would be great if we could access it via SQL commands!

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31045
yes there is - i dont have the api's in front of me right now but its something like:
if musicbeeApi.Library_Query(query)
- this initiates the query - for now just pass null as the query but when the parameter is supported it will be the same query xml as auto-playlists
  repeat
     url = musicbeeApi.Library_QueryGetNext()
     if url is null then exit loop
     artist = musicbeeApi.Library_GetFileMetadata(url, artist field code)  - the supported fields codes are defined in an enumeration
     title = musicbeeApi.Library_GetFileMetadata(url, title field code)
     ...
  loop
end

you can see each api signature in the MusicBeeInterface file in the examples zip

Londinium

  • Jr. Member
  • **
  • Posts: 21

thegreyspot

  • Full Member
  • ***
  • Posts: 212
Is there anyway to integrate the musicbee api with java?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31045
no there isnt any java interface and I dont know how to interface between java and .NET.
Visual Studio a great development platform and C# is nice language, also useful in the corporate job market if you are interested to learn.