Author Topic: MusicBee API  (Read 293339 times)

boroda

  • Hero Member
  • *****
  • Posts: 4748
Steven, thanks for update. Will old AddMenuItem function also register hotkey now (the second parameter is a hotkey description, but it was never used by MB earlier)?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416

e-motiv

  • Full Member
  • ***
  • Posts: 188
Steven, I was updating my "speak back" plugin so now it could also say "from" which rating you are changing.  E.g. "Rating changed from 1 to 4".
So, logically, I used NotificationType.TagsChanging to get old value, but I discovered that doesn't work on keyboard shortcuts. (It does work with context menu editing.)
So is there another way to get the old rating from the track you are changing?
MB 2.0.4467
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

e-motiv

  • Full Member
  • ***
  • Posts: 188
Steven, I was updating my "speak back" plugin so now it could also say "from" which rating you are changing.  E.g. "Rating changed from 1 to 4".
So, logically, I used NotificationType.TagsChanging to get old value, but I discovered that doesn't work on keyboard shortcuts. (It does work with context menu editing.)
So is there another way to get the old rating from the track you are changing?
MB 2.0.4467
Bump?
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

ddelella

  • Newbie
  • *
  • Posts: 13
I am glad to see the API is available in C# and VB.NET.  Might I suggest an API section added to the website for documentation and easier downloading of the latest version.  Forums are never the best way to deliver updates because you have to search for the last post that contained a release plus you have to read for the latest changes.  I think jQuery probably does the best job in online documentation and ease of finding the API download.  Just a suggestion but great job with the application.  I am a developer and glad to see the move to .NET4. 

Another idea is possibly releasing a built in template for Visual Studio that sets up a plugin project.  This way you could build in certain features to the plugins which are required by the application, like the window design, resizing, and proper API references.  This just leave the design to the developer.

Thanks

kelsos

  • Sr. Member
  • ****
  • Posts: 302
I keep getting a System.NullReferenceException when I use the NowPlaying_GetLyrics() in the v2 betas, any ideas?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
the theater mode plugin is making use of that API without problems as far as i know.
It can return a null value (not sure if it always did that, and when that happens you could call NowPlaying_GetDownloadedLyrics() immediately afterwards and again after receiving NotificationType.NowPlayingLyricsReady)
if you are sure you are triggering an exception within MusicBee let me know the artist and title you are testing

kelsos

  • Sr. Member
  • ****
  • Posts: 302
Are the calls you mentioned above (Like GetDownloadedLyrics) in a version newer than this one: PluginInfoVersion = 1, MinInterfaceVersion = 6, MinApiRevision = 10? if so could you upload the updated interface file for c#?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
sent you a PM with the API interface - i will load this for everyone at a later date
Main code:
lyrics = mbApiInterface.NowPlaying_GetLyrics();
if (String.IsNullOrEmpty(lyrics) && mbApiInterface.ApiRevision >= 17) {
    // this can still return null, but calling it will trigger a notification when the lyrics have been downloaded
    lyrics=mbApiInterface.NowPlaying_GetDownloadedLyrics();
}

ReceiveNotification
NotificationType.NowPlayingLyricsReady:
            If (mbApiInterface.ApiRevision >= 17)
                xx = mbApiInterface.NowPlaying_GetDownloadedLyrics();
 

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
first post updated with links to the updated API interface.
See prior posts for explanations of the new API methods

e-motiv

  • Full Member
  • ***
  • Posts: 188
Steven, I was updating my "speak back" plugin so now it could also say "from" which rating you are changing.  E.g. "Rating changed from 1 to 4".
So, logically, I used NotificationType.TagsChanging to get old value, but I discovered that doesn't work on keyboard shortcuts. (It does work with context menu editing.)
So is there another way to get the old rating from the track you are changing?
MB 2.0.4467
Bump?
Bump. Any fixes or insights on this?
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
i have added
PluginNotifyType.RatingChanging

you will need this version of MusicBee (it will be in the next weekly update)
http://musicbee.niblseed.com/V2/MusicBee_Exe_Patched.zip

and the updated interface file
C#:
http://www.mediafire.com/?5727cyc53h3ja82
or VB:
http://www.mediafire.com/?652mh6o6l0aowak
Last Edit: September 02, 2012, 09:17:15 PM by Steven

e-motiv

  • Full Member
  • ***
  • Posts: 188
Thank you!
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

e-motiv

  • Full Member
  • ***
  • Posts: 188
i have added
PluginNotifyType.RatingChanging
I have finally tried it, but it still doesn't work.  It also gives me the rating AFTER having changed it, not BEFORE.  (Capitals not mean as shouting, just highlight.).
On NotificationType.RatingChanging, I do oldrating = mbAPI.Library_GetFileTag(sourceFileUrl, MetaDataType.Rating); , but it still tells the new rating in stead of the old. 
And even worse, before I think it did work (with tagschanging) on context editing, but now it doesn't work anywhere.  Any tips?
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

slimmeke

  • Jr. Member
  • **
  • Posts: 51
Is it possible to update the C++ library so I can use it for making a plugin.
I'm writing a plugin for the Logitech G15, G19 LCD. But the only language they support is C++.