How to use app.getObject

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

Moderator: jiri

How to use app.getObject

Postby TIV73 » Mon Sep 04, 2017 4:03 am

Hi everybody,
I am having slight issues using app.getObject. It appears like the only working filter for album objects is id. To illustrate:

Code: Select all
app.getObject('album', {id:232})
.then(album => album.id)
.then(albumID => app.getObject('album', {id:albumID}))
.then(album => console.log(album))
// object is returned here


app.getObject('album', {id:232})
.then(album => album.title)
.then(albumTitle => app.getObject('album', {title:albumTitle}))
.then(album => console.log(album))
// nothing is returned


A screenshot to clarify:
Image

I realize that you wouldn't usually use the promise chain like that, I only wanted to illustrate that filtering by album title doesn't work, even if the filter values are provided by the object itself, therefore ruling out typos. I tried the same with name, albumArtist and _persistentID, with the same result. The filter only works when using id.

Is it supposed to work like this or am I using the function incorrectly? In other words - if I have the name of an album and I want to get the tracklist for that album, how would I do that? I could probably get the album ID from getQueryResultAsync and then use that for getObject, but that seems to be a somewhat roundabout way of doing something that's (supposedly) straighforward to do.
TIV73
 
Posts: 38
Joined: Sat Nov 12, 2011 1:31 pm

Re: How to use app.getObject

Postby PetrCBR » Mon Sep 04, 2017 4:31 am

You can locate album using app.getObject only by album ID, MusicBrainz Release GID (mbgid), MusicBrainz Release Group GID (mbrggid).
If you need to get album by it's name use app.db.getAlbumAsync instead (at least album and artist parameters are required).
PetrCBR
 
Posts: 1330
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: How to use app.getObject

Postby TIV73 » Mon Sep 04, 2017 6:49 am

Perfect, that works for me. Thanks a lot for the help!
TIV73
 
Posts: 38
Joined: Sat Nov 12, 2011 1:31 pm


Return to MediaMonkey 5 developer forum

Who is online

Users browsing this forum: No registered users and 3 guests