Author Topic: MusicBee API  (Read 293337 times)

e-motiv

  • Full Member
  • ***
  • Posts: 188
It seems "RatingChanged" does not work for me.
"TagsChanging" and "TagsChanged" do work for me. Also, my settings dó save ratings to file (if it matteers at all).
Anything I ignore ?
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
it currently doesnt notify rating changes when done in the tag editor (will do for the next update)
it should be notifying if you update in the main panel or player control panel

e-motiv

  • Full Member
  • ***
  • Posts: 188
I see.  And indeed, it does work in the player control. But it does not work in the main panel though (e.g. Music Library and clicking on 4 stars).
But on the other side it DOES work where I most need it: When changing the now playing song through a keyboard shortcut! I did not bother to check that out before for some weird reason.  ::)
So, for me you don't have to fix this in the tag editor (unless someone will want that with my plugin later on, but I doubt it).

Something else  ;D  What's the best way to get the previous rating on RatingChanged?
(So I can let my speaking addon say like "Rating changed from 1 to 3")

Thanks
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
can you confirm its not working when clicking a rating in the main panel - i see no reason for it not to work, unless you are refering to using the tag editor docked in the main panel

i've updated the API as follows:
- Rating change now notified when changed in the tag editor
- you can now set tags on http:// files (still need to call Library_CommitTagsToFile but it just updates the internal MB cache)
- MB_AddMenuItem now returns the ToolStripItem object that was created

the updated interface definition file is in the first post

updated MusicBee.exe:
http://www.mediafire.com/?d3vv22moj53b6g3
Last Edit: November 17, 2011, 09:53:45 PM by Steven

e-motiv

  • Full Member
  • ***
  • Posts: 188
Thanks for the updates!  I will probably only be able to continue on the weekend.

But already this: For one reason or another a lot of my library files where not found (with a blue exclamation mark) (though they are there). Anyway, it was only with those that the ratingchanged did not work (only the other tagschanged). Did not notice before.
I don't know if that's how you intended it for missing(?) songs.  For me it's the same.
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Antonski

  • Sr. Member
  • ****
  • Posts: 356
can you confirm its not working when clicking a rating in the main panel - i see no reason for it not to work, unless you are refering to using the tag editor docked in the main panel

i've updated the API as follows:
- Rating change now notified when changed in the tag editor
- you can now set tags on http:// files (still need to call Library_CommitTagsToFile but it just updates the internal MB cache)
- MB_AddMenuItem now returns the ToolStripItem object that was created

the updated interface definition file is in the first post

updated MusicBee.exe:
http://www.mediafire.com/?d3vv22moj53b6g3

Is Rating change also notified when done from player control panel as well? Because, usually I rate the tracks while listening (by clicking the stars in control panel or in main panel, Album and tracks layout), I don't open explicitly Tag editor.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
Is Rating change also notified when done from player control panel as well? Because, usually I rate the tracks while listening (by clicking the stars in control panel or in main panel, Album and tracks layout), I don't open explicitly Tag editor.
its anywhere the rating is changed

e-motiv

  • Full Member
  • ***
  • Posts: 188
Changing ratings via the editor triggers Notification TagsChanged, but NOT RatingChanged.
(It dóes trigger both with other ways of changing tags.)

Problem for my specific plugin is that I cannot know on TagsChanged if the rating was changed or not, and thus not inform the user of it. 

But it's actually not that important. So íf this is something to fix, it's totally OK to put it on the long term list.  Just wanted to inform.
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
can you confirm the version you are using as its working fine for me when changing the rating in the tag editor in my test plugin

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
actually dont worry as i found the reason

kelsos

  • Sr. Member
  • ****
  • Posts: 302
May I ask, is there a way to access the lyrics MB retrieved for the playing track through the API?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
yes - for lyrics of the playing track:
NowPlaying_GetLyrics

for lyrics for a specific file:
Library_GetLyrics

they just return current values and dont atempt to download them if not already downloaded

kelsos

  • Sr. Member
  • ****
  • Posts: 302
I was trying the NowPlaying_GetLyrics before, however it returns nothing when called, even though I can see the lyrics on the player just fine.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
Library_GetLyrics and NowPlaying_GetLyrics were only returning lyrics directly associated with the music file
I have changed it so NowPlaying_GetLyrics retrieves lyrics from the web when no lyrics are directly associated (and if the user has enabled web-retrieval for lyrics) so its consistent with the Now Playing panel.
Library_GetLyrics is unchanged from the current behavior.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
these new additions require version 2 of musicbee

VB Source:
http://www.mediafire.com/?32z0uhc2l75cuth

C# Source:
http://www.mediafire.com/?tc2rfly0rpkrr7g

C++ Source - hasnt been updated, so contact me if you need to use the new features



public void MB_RegisterCommand(string command, EventHandler handler)
public font Setting_GetDefaultFont()
public bool Player_GetShowTimeRemaining()
public int NowPlayingList_GetCurrentIndex()
public string NowPlayingList_GetFileUrl(int index)
public string NowPlayingList_GetFileProperty(int index, FilePropertyType type)
public string NowPlayingList_GetFileTag(int index, MetaDataType type)

MB_RegisterCommand - enables a hotkey to be assigned to a plugin callback function, where "command" is a description of the command that will be displayed in the HotKey preferences
Setting_GetDefaultFont - returns the default font set in MusicBee
NowPlayingList_GetCurrentIndex - returns the index in the now playing list of the current playing track
NowPlayingList_GetFileUrl, NowPlayingList_GetFileProperty and NowPlayingList_GetFileTag allow you to get information for a track in the now playing list
Last Edit: February 22, 2012, 07:58:15 PM by Steven