by smellhole » Fri Aug 05, 2022 9:19 am
I got this working to at least show two different colors, one for less than 321 and one for more than 1411. Basically, for me, that's MP3s, then 16-bit FLAC, then 24-bit FLAC, which is all I have in my collection.
Code: Select all
/* 'This file is part of MediaMonkey licensed for use under the Ventis Media End User License Agreement, and for the creation of derivative works under the less restrictive Ventis Limited Reciprocal License. See: https://www.mediamonkey.com/sw/mmw/5/Ventis_limited_reciprocal_license.txt' */
// A simple example of formatting of a tracklist column - in this case bitrate color is modified, very low bitrates in red, etc.
uitools.tracklistFieldDefs.bitrate.override({
bindData: function ($super, div, item) {
$super(div, item); // override() gives us $super, so we can call the original code, which renders bitrate and we can only change the color here
// Note that from performance point of view, it would make more sense to rather do it all here, without calling $super, this is just an example.
var bitrate = Math.round(item.bitrate / 1000);
div.style.fontWeight = '';
if (bitrate > 1411) {
div.style.color = 'blue';
div.style.fontWeight = '';
} else
if (bitrate < 321)
div.style.color = 'green';
else {
div.style.color = '';
}
}
});
I got this working to at least show two different colors, one for less than 321 and one for more than 1411. Basically, for me, that's MP3s, then 16-bit FLAC, then 24-bit FLAC, which is all I have in my collection.
[code]
/* 'This file is part of MediaMonkey licensed for use under the Ventis Media End User License Agreement, and for the creation of derivative works under the less restrictive Ventis Limited Reciprocal License. See: https://www.mediamonkey.com/sw/mmw/5/Ventis_limited_reciprocal_license.txt' */
// A simple example of formatting of a tracklist column - in this case bitrate color is modified, very low bitrates in red, etc.
uitools.tracklistFieldDefs.bitrate.override({
bindData: function ($super, div, item) {
$super(div, item); // override() gives us $super, so we can call the original code, which renders bitrate and we can only change the color here
// Note that from performance point of view, it would make more sense to rather do it all here, without calling $super, this is just an example.
var bitrate = Math.round(item.bitrate / 1000);
div.style.fontWeight = '';
if (bitrate > 1411) {
div.style.color = 'blue';
div.style.fontWeight = '';
} else
if (bitrate < 321)
div.style.color = 'green';
else {
div.style.color = '';
}
}
});
[/code]