extendedTagsShort truncated to 400 characters?

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

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

Topic review
   

Expand view Topic review: extendedTagsShort truncated to 400 characters?

Re: extendedTagsShort truncated to 400 characters?

by drakinite » Thu Sep 21, 2023 5:09 pm

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:

Code: Select all

(async () => {
    let promises = [];
    fastForEach(t, (track) => {
        promises.push(track.getExtendedTagsAsync());
    });
    let tagsList = await Promise.all(promises);
    console.log(tagsList);
})();
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.

Re: extendedTagsShort truncated to 400 characters?

by drakinite » Thu Sep 21, 2023 4:51 pm

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)

extendedTagsShort truncated to 400 characters?

by Platonius » Thu Sep 21, 2023 4:41 am

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?

Top