Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Alternate rows playlist style (Read 4132 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Alternate rows playlist style

I have Columns UI.
Is there a way I can do something like this:

- Song A (Version 1)
- Song A (Version 2)

- Song B
- Song C
- Song D (Version 1)
- Song D (Version 2)
- Song D (Version 3)


Notice the highlights.
I'd like to do something similar: highlight groups of the same song alternating.

Someone can help me?
Thank you =)


Alternate rows playlist style

Reply #2
I assume the colored text is displaying track items from one album in the "Title" column of the Playlist Viewer ("NG Playlist").

The title-formatting expression for your "Title" column needs to have a conditional method of coloring the display,

Expressed as pseudo-code: if this value is found in a tag or path, then color string like this, else color string like that

I use some conditional coloring syntax in my own Playlist Viewer "Title" column; the syntax expression is very very long and highly esoteric to my needs.

BenB -- I am not very familiar with practical usage of the $crc32 title-formatting function. Could you give a working example or two of how it could be used for this or related puposes.
The example at HA Wiki uses another function named $mod. That one bamboozles me too; I have no idea of how to use it in a practical way nor do I find the description at HA Wiki helpful except in some dry technical sense.

Alternate rows playlist style

Reply #3
$mod just gives the remainder when you divide 2 numbers. for example

$mod(7/2) gives you 1. this is because 7 isn't exactly divisible by 2 when you want the result to be a whole number. the nearest number lower than 7 that is divisible by 2 is 6. therefore 7-6 = 1

a few more

$mod(7,4) is 3
$mod(8,2) is 0

so now you should understand the example on the title formatting reference page. performing $crc32 on any string is generally going to result in a pretty large number. so if you run the $mod function on it with 256, the remainder is always going to be between 0 and 255 which is needed for the $rgb function.

Alternate rows playlist style

Reply #4
Thanks everyone.
If this can help, my folder is structured like

- ARIST FOLDER
- - Song A [Version 1]
- - Song A [Version 2]
- - Song B

As you said, I'd need some conditional functions, but it's really complex, I thought it was much easier. I'd need something that makes me count the same versions of the song as one element only, so I could apply the default global style (alternating one and one).

If the song playing has different versions, color them all with color A, else color only that one with A. The next song in the index, if has different versions, color them all with color B, else color it only with B. etc.

To give an idea, here's a snap:



Is this achievable?
Thank you guys.

EDIT
Using this
Code: [Select]
$if($greater($strstr(%filename%,'['),0),0,1)

makes all the track that have versions as 0 and all the tracks "solo, only" with 1.
Still can't think of how to make it

EDIT 2
If I combine that with
Code: [Select]
$mod(%list_index%,2)

I think I did it. I'm trying it

EDIT 3
Harder than I thought, lol.

Alternate rows playlist style

Reply #5
Code: [Select]
$ifequal($get(abc),0,
'same color'
,
'different'
)


$get(abc) returns 1 if the song has a [ in the filename (meaning it has different versions).
There is a problem, however: Fable is listed as same color, even if it's in the group of different versions. So, is there a function that check if title is the same of the next or something similar?


Alternate rows playlist style

Reply #6
you cannot compare tracks at all. everything is evaluated on a per track basis.


Alternate rows playlist style

Reply #8
Ok then... is there a work around to do this?

Nope, not even in principal. You can just create an expression that yields the same value (i.e. color) for tracks with the same title.

Alternate rows playlist style

Reply #9
you can either check for the existence of text/properties that already exist in your files or you can create your own new custom tags/values. this could determine exactly what colour you get for each file. obviously this is more work for you but that's the only way to do it.

Alternate rows playlist style

Reply #10
Thank you marc, I think however that it's a lot of work and there has to be a way

Quote
Nope, not even in principal. You can just create an expression that yields the same value (i.e. color) for tracks with the same title.

I have no idea on how to do this. An example would be gold ^^
Thank you


Still missing that part

Alternate rows playlist style

Reply #11
there has to be a way


says who? i'm not trying to be funny but foobar is not psychic. as i keep on saying, it can only work on the tags or properties of each and every file. no ifs, no buts.

Alternate rows playlist style

Reply #12
Quote
You can just create an expression that yields the same value (i.e. color) for tracks with the same title.

This should help in doing it.

The tag that I could use is the title, for the Children track is always the same, while the filename is different (Children [Guitar mix])
What I'm missing is just to divide when two tracks that have multiple versions are near, like in the screenshot ^ there is Children and then Fable.

Thank you anyway

Alternate rows playlist style

Reply #13
Commented code example (tested as column display code for Columns UI, NG playlist):

Code: [Select]
// str: input string
$puts(str,%title%)

// find position of first opening parenthesis ( or bracket [ in str
$puts(first_parenthesis,$max($strstr($get(str),' ['),$strstr($get(str),' (')))

// if first_paren has non-zero value, cut relevant part (before parenthesis) away from str
// relevant_str then determines the color
$puts(relevant_str,$ifgreater($get(first_parenthesis),0,$left($get(str),$sub($get(first_parenthesis),1)),$get(str)))

// set the red, green and blue color values (0-255 each)
// if color scheme is required, change code here
$puts(rrr,$mod($div($crc32($get(relevant_str)),1),256))
$puts(ggg,$mod($div($crc32($get(relevant_str)),1000),256))
$puts(bbb,$mod($div($crc32($get(relevant_str)),1000000),256))

// set color
// display str
$rgb($get(rrr),$get(ggg),$get(bbb))
$get(relevant_str)

Alternate rows playlist style

Reply #14
This thing is awesome, I have no words
I'm trying to modify it getting only two colors instead of all the spectrum, I hope it can be done

Anyway, big and huge thanks !

Alternate rows playlist style

Reply #15
Sorry for the double post



Is there a way to COMBINE the two functions/values?
Since I found it's impossible (for me, at least) to modify the code from ojdo (thanks dude!), I tried this other way

Alternate rows playlist style

Reply #16
foobar has no way of knowing how many tracks are in your "version groups", where groups begin and end, and the placement of groups in a playlist thus making it impossible to enumerate said groups so that 2 colors can be alternated.

Alternate rows playlist style

Reply #17
foobar has no way of knowing how many tracks are in your "version groups", where groups begin and end, and the placement of groups in a playlist thus making it impossible to enumerate said groups so that 2 colors can be alternated.

Thank you BenB
I think I'm going to group all the tracks from an artist for title, like this