Hi,
Currently working on something to be able to add specific extended tags to the display. And it works more or less, but I found that for some tracks the tag value would be displayed, and for others it would not be displayed.
Finally found that the extendedTagsShort tag seems to be truncated to 400 characters. So parsing of the JSON data in getExtendedTagsList fails. And I don't want to use getExtendedTagsAsync or something similar everytime the display updates.
So am I missing something here? Is there something I can use to get the whole extended tag field?
extendedTagsShort truncated to 400 characters?
Moderators: jiri, drakinite, Addon Administrators
Re: extendedTagsShort truncated to 400 characters?
You will need to use getExtendedTagsAsync() to get the full extendedTags field. Here's a more detailed explanation for why that is the case: viewtopic.php?p=513120#p513120 and viewtopic.php?p=513124#p513124
If you don't want to re-run getExtendedTagsAsync repeatedly, why not listen for a track's "change" event? It'll fire whenever any of the track's fields are changed.
Also, if you are dealing with multiple tracks at once, you could use async/await to make the programming simpler (let tags = await track.getExtendedTagsAsync() instead of track.getExtendedTagsAsync().then(function(tags) { })) or use Promise.all(). (I don't know if there's better or worse performance to use Promise.all() vs awaiting one after the other)
If you don't want to re-run getExtendedTagsAsync repeatedly, why not listen for a track's "change" event? It'll fire whenever any of the track's fields are changed.
Also, if you are dealing with multiple tracks at once, you could use async/await to make the programming simpler (let tags = await track.getExtendedTagsAsync() instead of track.getExtendedTagsAsync().then(function(tags) { })) or use Promise.all(). (I don't know if there's better or worse performance to use Promise.all() vs awaiting one after the other)
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Re: extendedTagsShort truncated to 400 characters?
Actually, if you're dealing with a bunch of tracks in a tracklist, Promise.all() makes the most sense, because you can't do async functions inside a read lock callback (note to self: add that to the docs). Here's a sample:
In this case, it's safe to use fastForEach because you don't need to cache the Track objects themselves; you only have to cache the getExtendedTagsAsync promises.
If you are worried about optimization, you could check for the longTextLoaded attribute and then use getExtendedTagsSync, but again I would not recommend it.
Code: Select all
(async () => {
let promises = [];
fastForEach(t, (track) => {
promises.push(track.getExtendedTagsAsync());
});
let tagsList = await Promise.all(promises);
console.log(tagsList);
})();
If you are worried about optimization, you could check for the longTextLoaded attribute and then use getExtendedTagsSync, but again I would not recommend it.
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.