[Solved] changing track color if found keyword in comment

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: [Solved] changing track color if found keyword in comment

Re: Help - changing track color if found keyword in comment

by Andre_H » Wed Feb 08, 2023 10:04 am

Ludek wrote: Mon Feb 06, 2023 7:51 am So replacing by item.commentShort should work to get the comment synchronously, but is limited to 200 chars
This works, thank you.

Re: Help - changing track color if found keyword in comment

by Barry4679 » Mon Feb 06, 2023 8:25 am

Ludek wrote: Mon Feb 06, 2023 7:51 am The is no comment, the is either commentShort or getCommentAsync
So replacing by item.commentShort should work to get the comment synchronously, but is limited to 200 chars
those documents don't list a property named commentShort.
You meant summary?
summary String
Defined in native\BaseMedia.js:1614
Gets shortened version of the track comment, max 200 characters, shortened with ellipses. Read-only. To get/set the full comment, use [[getCommentAsync]] and [[setCommentAsync]].

Re: Help - changing track color if found keyword in comment

by Ludek » Mon Feb 06, 2023 7:51 am

See the api reference: https://www.mediamonkey.com/docs/api/classes/Track.html

The is no comment, the is either commentShort or getCommentAsync : https://www.mediamonkey.com/docs/api/cl ... mmentAsync

So replacing by item.commentShort should work to get the comment synchronously, but is limited to 200 chars

[Solved] changing track color if found keyword in comment

by Andre_H » Fri Jan 20, 2023 5:52 am

Hi guys,

i try to color-code tracks (all fields of the track would be nice, but just the title would also be ok) in the main view, if a keyword is found in the tracks comment (example here "DUPLIKAT"). I used the "Highlight Bitrate" addon as a template, but the syntax of "includes" seems to fail me.

Code: Select all

// highlight track if comment contains 'DUPLIKAT'

uitools.tracklistFieldDefs.title.override({
    bindData: function ($super, div, item) {
        $super(div, item);

	var CommentCheck = item.comment;
        div.style.fontWeight = '';
        if (CommentCheck.includes('DUPLIKAT')) {
            div.style.color = 'blue';
        } else
            div.style.color = '';
    	}

});
"Application throw an exception "Cannot read properties of undefined (reading 'includes')".

Can anyone show me, what's wrong?

Top