HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: Synchronated on 2012-03-28 11:29:52

Title: Formatting help - conditional display of song title/artist
Post by: Synchronated on 2012-03-28 11:29:52
Hi all

I am trying to get NG Playlist to show track names just like the default user interface does, that is to say, display just the track name if %artist% is the same as %album artist%, but display '%title% / %artist%' if they differ.

The columns UI display code I am trying to use is something like
Code: [Select]
$if(%album artist%=%artist%,%title%,%title% / %artist%)


But I can find no reference on how to actually format conditional expressions. At the moment the condition here is ALWAYS returning TRUE, even if those values are not equal, so this always just returns %title%. So I essentially don't know how to compare two text strings to see whether they are the same (ifequal applies only to integers I believe).

Where am I going wrong/what would the code need to be to achieve what I'm talking about (which just means I don't need an Artist column)?

Many thanks
Title: Formatting help - conditional display of song title/artist
Post by: ruebe on 2012-03-28 11:49:45
you have to use $strcmp()

$ifequal($strcmp(%album artist%,%artist%),1,%title%,%title% / %artist%)

to satisfy all your future title formatting needs:
http://wiki.hydrogenaudio.org/index.php?ti...ormat_Reference (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference)
Title: Formatting help - conditional display of song title/artist
Post by: Synchronated on 2012-03-28 11:53:30
I've solved this by using just
Code: [Select]
%title%[ / %track artist%]

- this was clear to me once I discovered that %track artist% only exists at all if %album artist% and %artist% differ, so this achieves exactly what I needed.

Still not sure why my previous test just didn't work though (returning TRUE even if it was in fact FALSE) so if you know why, please say. Cheers

edit: thanks - I had read the formatting reference but had not clicked that's what I needed or why the other comparison did not work.