How to use app.getObject

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: How to use app.getObject

Re: How to use app.getObject

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

Perfect, that works for me. Thanks a lot for the help!

Re: How to use app.getObject

by 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).

How to use app.getObject

by 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.

Top