-
Notifications
You must be signed in to change notification settings - Fork 0
Music
Chris Willoughby edited this page Oct 23, 2015
·
5 revisions
Trove.Music is a class used to hold metadata on music or audio. It is a subclass of Trove.Work.
It can be constructed with an init argument to request the data immediately:
var my_music = new Trove.Music({
init: 9291894,
done: function(music) {
console.log(JSON.stringify(music, null, '\t'));
}
});
or you can use the get() method to request the data at some later time:
var my_music = new Trove.Music({
done: function(music) {
console.log(JSON.stringify(music, null, '\t'));
}
});
my_music.get({id: 9291894});
If you want to re-request data, perhaps with more included information, just call get() again with the includes and/or reclevel options (the id parameter is optional if specified earlier):
my_music.get({
id: 9291894,
reclevel: Trove.RECLEVEL.FULL
});
You can also specify these on construction:
function music_done (music) {
console.log(JSON.stringify(music, null, '\t'));
}
var my_music = new Trove.Music({
init: 9291894,
reclevel: Trove.RECLEVEL.FULL,
includes: [Trove.INCLUDE.TAGS, Trove.INCLUDE.COMMENTS],
done: music_done
});
The done and fail callbacks can be set via the options on construction or on the get() method. If set with the get() method after being set on construction, the new callbacks will be used from there on.