Available COM interface

To discuss development of addons / skins / customization of MediaMonkey.

Moderator: jiri

Re: Available COM interface

Postby PetrCBR » Tue Dec 12, 2017 1:52 am

In next build new method will be implemented ... SDB.fromJSON (currently just SongList is supported). In JS we have asJSON property implemented for all of our classes so using SDB.runJSCode you can run any JS code from COM model and return object(s) exported as JSON string. Simple example of getting current now playing tracklist using runJSCode and convert it to SongList object:
Code: Select all
Dim SDB : Set SDB = CreateObject("SongsDB5.SDBApplication")
Dim SLText : SLText = SDB.runJSCode("(function() { return app.player.getSongList().getTracklist().asJSON; })()", True)
Dim SL : Set SL = SDB.fromJSON(SLText)
PetrCBR
 
Posts: 1346
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: Available COM interface

Postby Barry4679 » Sat Jan 13, 2018 10:50 pm

Ludek wrote:Anyhow looking into our code you seem to be right that SDBPlayList is not fully implemented, most of the code of the corresponding properties/methods is commented out.
Seems to make sense to add them, going to discuss with other devs and look into it.


Has there been any decision on this request?

I see the following post by PetrCBR. That post doesn't relate to this request does it?
Barry4679
 
Posts: 258
Joined: Fri Sep 11, 2009 8:07 am
Location: Australia

Re: Available COM interface

Postby PetrCBR » Sun Jan 14, 2018 5:37 am

Using code i've sent you can receive any tracklist to your COM.
PetrCBR
 
Posts: 1346
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: Available COM interface

Postby Barry4679 » Sun Jan 14, 2018 7:11 pm

PetrCBR wrote:Using code i've sent you can receive any tracklist to your COM.


Sorry, I thought it was a general announcement, and not something in response to my request. ... thanks.

I am programming using Python. ... I don't know Javascript, nor VB ... but I can investigate ... you do expect that this facility will be available to me from Python?

PetrCBR wrote:In next build new method will be implemented


Still a future build? ... or is available in the now current build?

PetrCBR wrote:SDB.fromJSON (currently just SongList is supported). In JS we have asJSON property implemented for all of our classes so using SDB.runJSCode you can run any JS code from COM model and return object(s) exported as JSON string.


I can get the contents of an autoplaylist somehow via SongList? ... or do you plan to add SDBPlayList later?

PetrCBR wrote:Simple example of getting current now playing tracklist using runJSCode and convert it to SongList object:
Code: Select all
...


You wouldn't happen to have a "simple example" initiating this from Python? ... and maybe also getting the contents from an autoplaylist? :roll:

I have an app which does some things with MM static playlists ... I have requests to also extend support to MM autoplaylists ... I can do so with MM4, but don't really want to offer this if it will be broken by MM5, and I have no way to fix it.
Barry4679
 
Posts: 258
Joined: Fri Sep 11, 2009 8:07 am
Location: Australia

Re: Available COM interface

Postby PetrCBR » Mon Jan 15, 2018 2:28 am

Sorry, but i''ve used python in linux only (just for basic things).
PetrCBR
 
Posts: 1346
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: Available COM interface

Postby jiri » Wed Jan 17, 2018 4:30 am

Hi Barry,

I also haven't tried to work with MM COM from Python, but I suppose that it shouldn't be much different than the sample code above, i.e. if you already have the SDBApplication object, you only need to get the tracklist through the generic runJSCode() function and then convert it to a MM COM API object using fromJSON().

Jiri
jiri
 
Posts: 5299
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic

Re: Available COM interface

Postby Barry4679 » Wed Jan 17, 2018 9:00 pm

Thanks for responses.

To clarify. I have no trouble using Mediamonkey|COM|Python.

I was requesting that you add (at least part of) SDBPlayList to your COM implementation plans for MM5.

Use Case: The contents of a static playlist may be obtained by a simple ExecSQL, but a autoplaylist would require reverse engineering in MM5 to get exactly the same track inclusion criteria and sort sequence.

I made several suggestions:
* implement the readonly members from SDBPlayList, and PlayListByTitle & PlayListByID from SDBApplication
* or provide a COM method to populate a named static playlist with the current contents of a named autoplaylist
* or a COM method to return the sql criteria for a named static playlist
* or anything that you may suggest

PetrCBR responded with a comment about a new method SDB.fromJSON

? "SDB.fromJSON (currently just SongList is supported)" ... I am not sure what this means? .. I will be able to get the tracklist of an autoplaylist?
? what language was his code example? ... I guessed Visual Basic ... or was it JS? ... I was meaing did he have a code sample (in that language) which obtained the contents of a specific autoplaylist
? the new method is available in 2088, or the next build?

Apologies if my question was worded poorly and caused confusion.
Barry4679
 
Posts: 258
Joined: Fri Sep 11, 2009 8:07 am
Location: Australia

Previous

Return to MediaMonkey 5 developer forum

Who is online

Users browsing this forum: No registered users and 3 guests