Skip to main content

Topic: Formatting help - conditional display of song title/artist (Read 595 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
Formatting help - conditional display of song title/artist
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
  • Last Edit: 28 March, 2012, 06:41:06 AM by Synchronated

  • ruebe
  • [*][*][*]
Formatting help - conditional display of song title/artist
Reply #1
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

Formatting help - conditional display of song title/artist
Reply #2
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.
  • Last Edit: 28 March, 2012, 06:56:10 AM by Synchronated