Author Topic: MusicBee API  (Read 285432 times)

samlangten

  • Newbie
  • *
  • Posts: 9
In fact i have implemented localization by adding localization resx files and set Localizable property in Form class which is internal way of localization implementation in WinForm. I use System.Threading.Thread.CurrentUICulture.DisplayName to detect which language user is using, but what it returns seems depend on language setting of user's operation system instead of setting of MusicBee. So i want to get language setting of MusicBee to enable this internal way of implementation.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
I see, in that case there is no API call available. As a workaround, you could get a specific id, and compare it the expected value that the translator has set

MiDWaN

  • Jr. Member
  • **
  • Posts: 78
Hi Steven,

Per several users' request, I'd like to implement a few extra features in the Subsonic plugin:
1) Save Playlists. There are currently GetPlaylists() and GetPlaylistFiles() which are already working, but is there a call I can use for saving them?
2) Get Podcasts. Is there a method that gets called for that through the API, that I can use to implement?
3) Save ratings. Again, is there a method that gets called that I can use to implement?

Thanks!

boroda

  • Sr. Member
  • ****
  • Posts: 4595
for 3: use Library_SetFileTag(sourceFileUrl, MetaDataType.Rating, "xx"), where xx is in range 0-100 (%), i.e. Library_SetFileTag(sourceFileUrl, MetaDataType.Rating, "20") for 1 star.

MiDWaN

  • Jr. Member
  • **
  • Posts: 78
for 3: use Library_SetFileTag(sourceFileUrl, MetaDataType.Rating, "xx"), where xx is in range 0-100 (%), i.e. Library_SetFileTag(sourceFileUrl, MetaDataType.Rating, "20") for 1 star.

Thanks for the reply, but I'm not sure how that would work?
I'm trying to save ratings from MusicBee back to Subsonic, through the plugin. To do that, MusicBee would need to have a call to a plugin method/function that I can then implement and send the information over.

I think what you mentioned above would do it the other way around, right?

boroda

  • Sr. Member
  • ****
  • Posts: 4595
don't understand. do you need to receive a notification in subsonic plugin that rating is changed?

MiDWaN

  • Jr. Member
  • **
  • Posts: 78
Close, I need to send a rating that was set in Musicbee over to the Subsonic server, through my plugin. So a notification might help, but I'd also need the actual track and new rating information.
So basically, I'm wondering if there's a method call that is triggered when a rating is set in Musicbee, which I can use through the API.

If there is, then it would be a matter of implementing that and sending the rating to the server (which is something I already know how to do).
Similar to let's say, clicking on a track and getting the Artwork fetched. There's "GetArtwork()" that is called when a user clicks on a track...

boroda

  • Sr. Member
  • ****
  • Posts: 4595
misunderstood you first. use this:

Code
        // receive event notifications from MusicBee
        // you need to set about.ReceiveNotificationFlags = PlayerEvents to receive all notifications, and not just the startup event
        public void ReceiveNotification(string sourceFileUrl, NotificationType type)
        {
            // perform some action depending on the notification type
            switch (type)
            {
                case NotificationType.RatingChanged:
                //perform some action here
                break;
             }
          }

to get new rating use:
Code
Library_GetFileTag(sourceFileUrl, MetaDataType.Rating)

MiDWaN

  • Jr. Member
  • **
  • Posts: 78

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
1) Save Playlists. There are currently GetPlaylists() and GetPlaylistFiles() which are already working, but is there a call I can use for saving them?
2) Get Podcasts. Is there a method that gets called for that through the API, that I can use to implement?
i will look at this is a couple of weeks time

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
1) Save Playlists. There are currently GetPlaylists() and GetPlaylistFiles() which are already working, but is there a call I can use for saving them?
actually all the functions you need are there eg.
Playlist_CreatePlaylist(string folderName, string playlistName, string[] filenames)
and various other Playlist_xxxx functions to adjust the playlist files

2) Get Podcasts. Is there a method that gets called for that through the API, that I can use to implement?
can you tell me what you want to do with this? There is a hierarchical structure of subscriptions and episodes to consider
Last Edit: February 26, 2019, 08:00:27 PM by Steven

MiDWaN

  • Jr. Member
  • **
  • Posts: 78
Hi Steven,

1) Thanks, I'll look into this further once I get a chance again

2) The actual request from the users was: if there is a way to listen to podcasts that I have on my libresonic server.

I know how to get them from the server, but I don't know how to integrate and make that work with MusicBee.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
2) The actual request from the users was: if there is a way to listen to podcasts that I have on my libresonic server.

I know how to get them from the server, but I don't know how to integrate and make that work with MusicBee.
Its not clear to me what you are asking for, especially with this statement "I know how to get them from the server, but I don't know how to integrate and make that work with MusicBee."

If you simply want to view and play the podcasts in the MusicBee library, you need to describe how you would want to navigate and select them as there is a subscription/ episode structure, and each subscription can have a huge number of files, many of which might only exist on the source website.

MiDWaN

  • Jr. Member
  • **
  • Posts: 78
Sorry if I wasn't clear enough.
The Subsonic API supports a few methods we can call regarding Podcasts: http://www.subsonic.org/pages/api.jsp#getPodcasts

E.g. with "getPodcasts", we can retrieve all Podcast channels the server subscribes to, and (optionally) their episodes. An example of such a call can be found here:
http://www.subsonic.org/pages/inc/api/examples/podcasts_example_1.xml

Then there are calls to Refresh Podcasts, Download an Episode, etc.

I can implement all those calls in the Plugin, but we'd also need some way to use/trigger them from MusicBee's interface.

For example, "Podcast Directory" could be intercepted by plugins (if implemented) to call "getPodcasts" as in my example above. The results coming from the server could then be returned to MusicBee so that it can show them on the GUI (with the expected structure of course).
A "Refresh" on a Podcast channel could be implemented by plugins to call a refresh on the server side and return the results, and so on.

Hope this makes it a bit more clear?

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
I not willing to do the podcast request as i think it will involve too much effort to implement for the benefit it provides