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: [Skinning] Can compare current and next track title in the [label] element? (Read 441 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[Skinning] Can compare current and next track title in the [label] element?

I would like to implement the following function into my skin:
comparing current and next track title and displaying nothing if TRUE (i.e., in one track playback mode); otherwise displaying next track title.

Currently, *if onetrack is not available.
On newer beta version (v1.5), however, we can use foobar2000 titleformatting tag and function in the [label] element.
So I thought I could implement this function by using $strcmp(A,B) function to compare the current and next track titles like below.

Code: [Select]
[label]
62.5,1375,827.5,100
left
[infosource-nowplaying]$puts(now,%title%)[infosource-nextplaying]$puts(next,%title%)$if($strcmp(now,next),,next)

Unfortunately, this script did not work.
After much trial and error, I found that using $puts(key, value) more than once and $if(cond,then,else) seem to work fine on the [label] element.
In addition, it appears that [title] and [nexttitle] cannot be used with titleformatting; titleformatting is ignored.

I found that using [infosource-nowplaying] or [infosource-nextplaying] appears to clear the variables defined prior to that.
That is, in the above script, the now variable becomes undefined at the time of string comparison, and the comparison result is always FALSE.
(@Peter Is this behavior of [infosource-] as designed?)

If there is a better way to implement this feature, please let me know.

Re: [Skinning] Can compare current and next track title in the [label] element?

Reply #1

Code: [Select]
[label]
62.5,1375,827.5,100
left
[infosource-nowplaying]$puts(now,%title%)[infosource-nextplaying]$puts(next,%title%)$if($strcmp(now,next),,next)

You seem to have missed $get

[infosource-nowplaying]$puts(now,%title%)[infosource-nextplaying]$puts(next,%title%)$if($strcmp($get(now),$get(next)),,next)

edit : but I see your point that you can't mix [fields] types in titleformatting and you can't mix [infosource] switching in the titleformat.
It just doesn't work..

Re: [Skinning] Can compare current and next track title in the [label] element?

Reply #2

Code: [Select]
[label]
62.5,1375,827.5,100
left
[infosource-nowplaying]$puts(now,%title%)[infosource-nextplaying]$puts(next,%title%)$if($strcmp(now,next),,next)

You seem to have missed $get

[infosource-nowplaying]$puts(now,%title%)[infosource-nextplaying]$puts(next,%title%)$if($strcmp($get(now),$get(next)),,next)

edit : but I see your point that you can't mix [fields] types in titleformatting and you can't mix [infosource] switching in the titleformat.
It just doesn't work..

Thank you for pointing out a mistake in my code.
Anyway, the only way to implement what I want to do would be to wait for an update on the parsing processing of skin files.