HydrogenAudio

Hosted Forums => foobar2000 => foobar2000 mobile => Topic started by: Daiki on 2024-02-07 13:22:44

Title: [Skinning] Can compare current and next track title in the [label] element?
Post by: Daiki on 2024-02-07 13:22:44
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.
Title: Re: [Skinning] Can compare current and next track title in the [label] element?
Post by: zeremy on 2024-02-24 21:19:18

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..
Title: Re: [Skinning] Can compare current and next track title in the [label] element?
Post by: Daiki on 2024-02-25 06:18:28

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.