Author Topic: MusicBee API  (Read 285437 times)

NighTeagle

  • Jr. Member
  • **
  • Posts: 22
Is it possible that the project file is missing from the VB.Net source ?
I've been trying to add a VB project to the solution, but so far I can't get it to work.

The C# source does have a project file.


NighTeagle

  • Jr. Member
  • **
  • Posts: 22
Oh everything makes much more sense now.
Thanks for the quick fix!

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10691
I was trying to finally get myself set up with this in Visual Studio, and noticed on the main downloads page that it's still the 3.0 API. Should that be updated?

Update: unrelated, but whoo-boy! I accidentally downloaded the VB version of it at first and I was freaking out a little. Got C# now, much better. I'm impressed you can maintain both, Steven.
Last Edit: November 23, 2019, 04:30:58 AM by psychoadept
MusicBee Wiki
Use & improve MusicBee's documentation!

Latest beta patch (3.5)
(Unzip and overwrite existing program files)

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
I was trying to finally get myself set up with this in Visual Studio, and noticed on the main downloads page that it's still the 3.0 API. Should that be updated?
that is an old link - where did you get it from?

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10691
Here? https://getmusicbee.com/help/api/

Although I realize now it says "for MusicBee 3.0" not API version 3.0, so maybe it's fine. I downloaded the file from this thread to be sure (that's where I grabbed the wrong one).

I was totally gonna text myself VB if I had to, but I'm glad I don't.
MusicBee Wiki
Use & improve MusicBee's documentation!

Latest beta patch (3.5)
(Unzip and overwrite existing program files)

karaluh

  • Jr. Member
  • **
  • Posts: 30
I'm writing a ListenBrainz scrobbler plugin, is it possible to extend the NowPlaying_GetFileTag method to get MBIDs?
ListenBrainz plugin for MusicBee:
https://github.com/karaluh/ScrobblerBrainz

boroda

  • Sr. Member
  • ****
  • Posts: 4595

Azthenix

  • Newbie
  • *
  • Posts: 2
Player_SetRepeat(RepeatMode.One) doesn't work. It only toggles between All and None mode.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
this should fix the issue. I will include in the next official release which should be soon

https://getmusicbee.com/patches/MusicBee33_Patched.zip
unzip and replace the existing musicbee application files

Azthenix

  • Newbie
  • *
  • Posts: 2
this should fix the issue. I will include in the next official release which should be soon

https://getmusicbee.com/patches/MusicBee33_Patched.zip
unzip and replace the existing musicbee application files

Yes, it now works. Thank you so much.

Mugwump

  • Newbie
  • *
  • Posts: 5
I've called
Code
MB_SetBackgroundTaskMessage
from inside my task callback thread but I cannot see where this is supposed to be shown on the taskbar?

With the background tasks is it possible to set the taskbar progress indicator using the MB API?
Last Edit: October 31, 2020, 09:18:55 AM by Mugwump

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
With the background tasks is it possible to set the taskbar progress indicator using the MB API?
The api call updates the text on the MusicBee status bar, not the windows taskbar. I do recall though that if the player controls panel shows a wavebar, the text for the playing track takes precedence.

You should be able to update the taskbar progress by getting a handle to the musicbee application window using: MB_GetWindowHandle()
and using that handle there are windows api calls to update the windows taskbar progress. This is some code:
Code
private enum TBATFLAG
{
    TBATF_USEMDITHUMBNAIL = 0x1,
    TBATF_USEMDILIVEPREVIEW = 0x2
}

private enum TBPFLAG
{
    TBPF_NOPROGRESS = 0,
    TBPF_INDETERMINATE = 0x1,
    TBPF_NORMAL = 0x2,
    TBPF_ERROR = 0x4,
    TBPF_PAUSED = 0x8
}

private enum THBMASK
{
    THB_BITMAP = 0x1,
    THB_ICON = 0x2,
    THB_TOOLTIP = 0x4,
    THB_FLAGS = 0x8
}

private enum THBFLAGS
{
    THBF_ENABLED = 0,
    THBF_DISABLED = 0x1,
    THBF_DISMISSONCLICK = 0x2,
    THBF_NOBACKGROUND = 0x4,
    THBF_HIDDEN = 0x8
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
private struct THUMBBUTTON
{
    [MarshalAs(UnmanagedType.U4)]
    public THBMASK dwMask;
    public uint iId;
    public uint iBitmap;
    public IntPtr hIcon;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
    public string szTip;
    [MarshalAs(UnmanagedType.U4)]
    public THBFLAGS dwFlags;
}

[StructLayout(LayoutKind.Sequential)]
private struct NATIVERECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[ComImport()]
[Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
private interface ITaskbarList3
{
    [PreserveSig()]
    void HrInit();
    [PreserveSig()]
    void AddTab(IntPtr hwnd);
    [PreserveSig()]
    void DeleteTab(IntPtr hwnd);
    [PreserveSig()]
    void ActivateTab(IntPtr hwnd);
    [PreserveSig()]
    void SetActiveAlt(IntPtr hwnd);
    [PreserveSig()]
    void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
    void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal);
    void SetProgressState(IntPtr hwnd, TBPFLAG tbpFlags);
    void RegisterTab(IntPtr hwndTab, IntPtr hwndMDI);
    void UnregisterTab(IntPtr hwndTab);
    void SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore);
    void SetTabActive(IntPtr hwndTab, IntPtr hwndMDI, TBATFLAG tbatFlags);
    void ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray)] THUMBBUTTON[] pButtons);
    void ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray)] THUMBBUTTON[] pButtons);
    void ThumbBarSetImageList(IntPtr hwnd, IntPtr himl);
    void SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription);
    void SetThumbnailToolTip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip);
    void SetThumbnailClip(IntPtr hwnd, ref NATIVERECT prcClip);
}

[Guid("56FDF344-FD6D-11d0-958A-006097C9A090")]
[ClassInterface(ClassInterfaceType.None)]
[ComImport()]
private class TaskbarListClass
{
}


    taskBarInterface = (ITaskbarList3)new TaskbarListClass();
    taskBarInterface.HrInit();

Last Edit: November 01, 2020, 01:39:10 AM by Steven

dandepeched

  • Jr. Member
  • **
  • Posts: 43
Hi @Steven, I'm developing Remote application for iOS and I'm trying to use API to reorder Now Playing list.
But I cannot make it to work properly if Shuffle is enabled.

I tried to get track index
Code
NowPlayingList_GetCurrentIndex();
to move track to different index
Code
NowPlayingList_MoveFilesDelegate(int[] fromIndices, int toIndex);
(so the indexes has looked like "from":4014,"to":5712)

After this action list got re-shuffled instead of moving 1 item.

I also tried to use actual displayed position by querying NowPlaying files
Code
NowPlayingList_QueryFiles(null);
(so position looked like "from":2,"to":3)
It gives me the same result - list got re-shuffled.

Maybe I'm using it wrong? Will appreciate any advice.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
NowPlayingList_MoveFiles uses the same internal functions as manually drag/dropping files, however i do see one inconsistency.
Does this version work better?
https://getmusicbee.com/patches/MusicBee34_Patched.zip

If not, are you saying that you are comparing NowPlayingList_QueryFiles(null) before and after the operation that its shuffled? If so, I dont see how that would have been case so could you explain how you determined the list is re-shuffled?