Author Topic: MusicBee API  (Read 293332 times)

boroda

  • Hero Member
  • *****
  • Posts: 4748
No, Steven, all is fine with using RefreshPanels() and CommitTags() calls. There is a problem with sending notifications to plugin. That's what I've found out (only for updating tags of playing track):

1. Clicking 'save' button in docked tag editor if no tag was *actually* changed always sends TagsChanged message.
2. Clicking 'save' button if any tag was *actually* changed sends TagsChanged message only after second click. 
3. Updating tag by API call never generates TagsChanged message (if track is playing).

Very strange behavior, not documented and unexpected.

Processing of TagsChanging message seems to work fine, but I've found another issue: play and pause track, close MB, restart MB, *actually* change any tag of paused track in tag editor or commit tags for this track using API, close MB. You'll get 'Unable to open file for writing' error message.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
i dont understand what you mean by "second click"
it should be sending TagsChanging immediately when you click save in the tag editor. There isnt any logic to determine if any tags actually changed or not.
if the file is not playing the TagsChanged should be immediate, otherwise if the file is being played then when the song finishes

i've done a very simple test using the API and i am finding the TagsChanging/TagsChanged messages are consistent with the above. Could you give me some steps to follow via your plugin so i can reproduce this?

boroda

  • Hero Member
  • *****
  • Posts: 4748
i dont understand what you mean by "second click"
Click twice (probably with some delay) on 'save' button (in docked tag editor) or click 'save' button and reopen floating tag editor and click 'save' again.

it should be sending TagsChanging immediately when you click save in the tag editor. There isnt any logic to determine if any tags actually changed or not.
Yes, its quite right for TagsChanging event, but I spoke about TagsChanged in this case. BTW I can grab only not yet changed tags on TagsChanging event, so it's useless in my case.

if the file is not playing the TagsChanged should be immediate, otherwise if the file is being played then when the song finishes
I said that I have no problem with tracks that are not played when tags are changed. Please reread first part of my previous post about currently played tracks.

i've done a very simple test using the API and i am finding the TagsChanging/TagsChanged messages are consistent with the above. Could you give me some steps to follow via your plugin so i can reproduce this?
I'm doubtful that you want to test my plugin. This is simple modification of your example plugin and this is source code (c#) for it. This plugin just shows message box with 'Track title' value displayed if it receives TagsChanged notification. Please repeat steps 1-2 from my previous post with this plugin enabled.



PS For step 3 from my previous post I meant 'Updating tag by API call never generates TagsChanged message (if track is playing until track is finished playing)'.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
i understood you are referring to playing tracks. What i am saying is its intentional that TagsChanged only gets generated when the file is physically updated ie. when the song finishes. Thats why i created 2 events because the tags are not written to file immediately when a song is playing. Perhaps its better called TagsWritten instead
What i could do is ensure the cached values are made available from the API as soon as TagsChanging is generated

edit:
the change is made for the next update - so as soon as TagsChanging is triggered any metadata queries will return the updated tag values, whether the song is playing or not
Last Edit: September 02, 2011, 10:28:10 PM by Steven

boroda

  • Hero Member
  • *****
  • Posts: 4748
What i could do is ensure the cached values are made available from the API as soon as TagsChanging is generated
That's what I really would want.

boroda

  • Hero Member
  • *****
  • Posts: 4748
Steven, feature request. Could you add an option to Library_QueryFiles function to filter tracks by tags. Currently I need to filter only by AlbumArtist and Album tags, but it would be great if there will be opportunity to filter by any tags.

kelsos

  • Sr. Member
  • ****
  • Posts: 302
For some reason I have an issue with the repeat changing through the API. When I am calling Player_SetRepeat(RepeatMode.One); it goes to RepeatMode.None, any idea why that happens?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
i think that API actually only supports toggling between repeat None and repeat On.
repeat One isnt supported via the API.
Is that going to be a problem?

kelsos

  • Sr. Member
  • ****
  • Posts: 302
No not really. I just need to know how to implement the repeat change.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
calling that API with the RepeatMode.None or RepeatMode.All should work - if it doesnt then its a bug (also make sure you are using the latest beta as i do recall at one point that api call wasnt refreshing the GUI)

e-motiv

  • Full Member
  • ***
  • Posts: 188
Furhter help with API problems here would be appreciated from anyone:
http://getmusicbee.com/forum/index.php?topic=3870.msg26454#msg26454
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

kelsos

  • Sr. Member
  • ****
  • Posts: 302
Is there a way to change the Playing track in the Now Playing List to a specific track (being in the list) directly by specifying the track location you get by a query? I tried with NowPlayingList_PlayNow but it will alter the Playlist so it is not a solution.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
i will be looking to enhance the API for the 1.4 release so i can look at it later in the week

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34416
i've made a change that will be included in the final 1.3 release - this is actually how i intended originally anyway

NowPlayingList_PlayNow(url) now searches the now playing list and if the file is located then the now playing list will jump to that file.
Otherwise the now playing list is reset as is the case now

http://www.mediafire.com/?3xsjaerhhe5j089

kelsos

  • Sr. Member
  • ****
  • Posts: 302
Thanks Thanks :D I can continue with the playlist feature of the remote control now :D