track listing font color by audio format?
Moderators: jiri, drakinite, Addon Administrators
track listing font color by audio format?
Hallo! I'm not sure if I should ask this here or in the add-ons section so I'll just err on this side...
I'm wondering if there's a way to have the display font for a track change color depending on the audio format. That way, when I look at a playlist, I'd get a clear view of what sort of files were in there.
Is that a thing at all?
I use the Code Monkey skin, should I ask that nice person?
Thanks.
I'm wondering if there's a way to have the display font for a track change color depending on the audio format. That way, when I look at a playlist, I'd get a clear view of what sort of files were in there.
Is that a thing at all?
I use the Code Monkey skin, should I ask that nice person?
Thanks.
::: Smellhole
::: It's better to have loved and lost than to never have had a good pair of speakers.
::: It's better to have loved and lost than to never have had a good pair of speakers.
-
- Posts: 1190
- Joined: Tue Jun 13, 2017 8:47 am
- Location: Vienna
Re: track listing font color by audio format?
@drakinite
There is a script "HighlightBitrate".
Could one program something like "smellhole" wishes?
There is a script "HighlightBitrate".
Could one program something like "smellhole" wishes?
MMW 4.1.31.1919 Gold-Standardinstallation
Re: track listing font color by audio format?
Yes, highlightBitrate is perfect example how to easily do this.
So just modify the code slightly there in trackListView_add.js and instead of
use something like:
i.e. copy [MMInstallFolder]/sampleScripts/highlightBitrate/ to [MMInstallFolder]/scripts/highlightBitrate/ and modify.
So just modify the code slightly there in trackListView_add.js and instead of
Code: Select all
if (bitrate < 128)
div.style.color = 'red';
else {
div.style.color = '';
}
Code: Select all
if (item.fileType == 'mp3')
div.style.color = 'red';
else {
div.style.color = '';
}
Re: track listing font color by audio format?
Thanks, guys. Not exactly how I thought it would get done, but this works well enough for my purposes, which were just temporary anyway. Thanks! You guys are great.
::: Smellhole
::: It's better to have loved and lost than to never have had a good pair of speakers.
::: It's better to have loved and lost than to never have had a good pair of speakers.
-
- Posts: 1190
- Joined: Tue Jun 13, 2017 8:47 am
- Location: Vienna
Re: track listing font color by audio format?
@Ludek
Thank's
I would love to combine that. I just don't know where to use this:
See the last four lines of code - UPDATE: The "Title" field should be colored with it!!!!
Thank's
I would love to combine that. I just don't know where to use this:
See the last four lines of code - UPDATE: The "Title" field should be colored with it!!!!
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 > 319) {
div.style.color = '';
div.style.fontWeight = 'bold';
} else
if (bitrate < 320)
div.style.color = 'red';
else {
div.style.color = '';
}
}
});
// ?????????????????????????????????????????????????????????????????????
// if (item.fileType.toUpperCase() == 'MP3') then item.Title.div.style.color = 'red';
// if (item.fileType.toUpperCase() == 'FLAC') then item.Title.div.style.color = 'green';
// if (item.fileType.toUpperCase() == 'WAV') then item.Title.div.style.color = 'yellow';
// if (item.fileType.toUpperCase() == 'OGG') then item.Title.div.style.color = 'blue';
Last edited by Erwin Hanzl on Fri Aug 05, 2022 9:28 am, edited 3 times in total.
MMW 4.1.31.1919 Gold-Standardinstallation
Re: track listing font color by audio format?
I would like to use this too!Erwin Hanzl wrote: ↑Fri Aug 05, 2022 8:53 am @Ludek
Thank's
I would love to combine that. I just don't know where to use this:
See the last four lines of code
::: Smellhole
::: It's better to have loved and lost than to never have had a good pair of speakers.
::: It's better to have loved and lost than to never have had a good pair of speakers.
Re: track listing font color by audio format?
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 = '';
}
}
});
::: Smellhole
::: It's better to have loved and lost than to never have had a good pair of speakers.
::: It's better to have loved and lost than to never have had a good pair of speakers.
-
- Posts: 1190
- Joined: Tue Jun 13, 2017 8:47 am
- Location: Vienna
Re: track listing font color by audio format?
Please see my UPDATE
Extension determines the title color.
Extension determines the title color.
MMW 4.1.31.1919 Gold-Standardinstallation
Re: track listing font color by audio format?
Was this for me? I don't know what to do with that, alas. I'm not really a coder though I can modify other people's scripts sometimes.Erwin Hanzl wrote: ↑Fri Aug 05, 2022 9:25 am Please see my UPDATE
Extension determines the title color.
::: Smellhole
::: It's better to have loved and lost than to never have had a good pair of speakers.
::: It's better to have loved and lost than to never have had a good pair of speakers.
-
- Posts: 1190
- Joined: Tue Jun 13, 2017 8:47 am
- Location: Vienna
Re: track listing font color by audio format?
Yes, for you and Ludek
I'm not a JavaScripter either, otherwise I would already have the solution.
So we wait for Ludek's solution.
I'm not a JavaScripter either, otherwise I would already have the solution.
So we wait for Ludek's solution.
MMW 4.1.31.1919 Gold-Standardinstallation
Re: track listing font color by audio format?
Roger, standing by.Erwin Hanzl wrote: ↑Fri Aug 05, 2022 9:33 am Yes, for you and Ludek
I'm not a JavaScripter either, otherwise I would already have the solution.
So we wait for Ludek's solution.
::: Smellhole
::: It's better to have loved and lost than to never have had a good pair of speakers.
::: It's better to have loved and lost than to never have had a good pair of speakers.
Re: track listing font color by audio format?
Yes, to change the title column colour use
uitools.tracklistFieldDefs.title.override (instead of current uitools.tracklistFieldDefs.bitrate.override)
i.e.
uitools.tracklistFieldDefs.title.override (instead of current uitools.tracklistFieldDefs.bitrate.override)
i.e.
Code: Select all
uitools.tracklistFieldDefs.title.override({
bindData: function ($super, div, item) {
$super(div, item);
if (item.fileType == 'mp3')
div.style.color = 'red';
else {
div.style.color = '';
}
}
});
Re: track listing font color by audio format?
Thank you, sir!
I ended up with this for my use. It just shows green for mp3 and blue for all of my 24-bit stuff.
Code: Select all
uitools.tracklistFieldDefs.title.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
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 = '';
}
}
});
::: Smellhole
::: It's better to have loved and lost than to never have had a good pair of speakers.
::: It's better to have loved and lost than to never have had a good pair of speakers.