Help - Search - Members - Calendar
Full Version: Conditional Aritst Formating
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
wolfsong
I'm trying to test for 2 conditions and not having much luck with any of the titleformating functions. In VB I would write something along the lines of
CODE
SELECT
   CASE %album artist% is "Various Artists"
   CASE $meta_num(artist) > 1
   THEN meta_sep(artist,', ',' & ')

I've tried using $OR which fails completely.
CODE
$or($if($strcmp(%album artist%,Various Artists),$meta_sep(artist,', ',' & ')),$ifgreater($meta_num(artist),1,meta_sep(artist,', ',' & ')))

And I've tried $IF3 which displays correctly for Various Artists but displays 1 for all others.
CODE
$if3($strcmp(%album artist%,Various Artists),($ifgreater($meta_num(artist),1,$meta_sep(artist,', ',' & '))),$meta_sep(artist,', ',' & '))

I'm pretty sure I'm just missing something in formatting the 2nd option. Maybe someone else can spot it. Thanks.
thuan
$or only works inside any variant of $if statements. I don't know VB but I guess that select statement of yours will do the then statement in both cases. Am I right?
If so try this:
CODE
$if($or($strcmp(%album artist%,Various Artists),$greater($meta_num(artist),1)),$meta_sep(artist,', ',' & '))

wolfsong
QUOTE(thuan @ Apr 2 2008, 23:01) *

$or only works inside any variant of $if statements. I don't know VB but I guess that select statement of yours will do the then statement in both cases. Am I right?

Select statements are similar to combining multiple IF-THEN statements. If any CASE is true, the THEN statement is executed. Each CASE is checked in sequence, not in tandem.

QUOTE(thuan @ Apr 2 2008, 23:01) *

CODE
$if($or($strcmp(%album artist%,Various Artists),$greater($meta_num(artist),1)),$meta_sep(artist,', ',' & '))


Unfortunately, this displays nothing if multiple their are multiple artists and the track is NOT Various Artists.

I really wish the documentation and example of $SELECT were better written; I can't make heads or tails of it.
thuan
QUOTE
Unfortunately, this displays nothing if multiple their are multiple artists and the track is NOT Various Artists.

I really wish the documentation and example of $SELECT were better written; I can't make heads or tails of it.

You meant the case that there're multiple artists in artist tag and the track is NOT Various Artist in Album Artist tag? That case works fine over here.

As for foobar $select, for example you have $select(n,a,b,c) then if n=1 it will return a, n=2 then it return b and so on. It's not like select in java or C#.

And $if3 will return the first parameter that is not an empty string.

Well if you still can't do it, can you elaborate more on what you're trying to do with an example set of metadata.
wolfsong
QUOTE(thuan @ Apr 3 2008, 00:39) *

QUOTE
Unfortunately, this displays nothing if multiple their are multiple artists and the track is NOT Various Artists.

I really wish the documentation and example of $SELECT were better written; I can't make heads or tails of it.

You meant the case that there're multiple artists in artist tag and the track is NOT Various Artist in Album Artist tag? That case works fine over here.

As for foobar $select, for example you have $select(n,a,b,c) then if n=1 it will return a, n=2 then it return b and so on. It's not like select in java or C#.

And $if3 will return the first parameter that is not an empty string.

Well if you still can't do it, can you elaborate more on what you're trying to do with an example set of metadata.

Opps! Your string does work. I have some other formatting and I just pasted incorrectly. Thanks.

Your $SELECT explanation is much better than what's documented. Thanks.

I just realized I need to make a tweak though. What I really want is.
CODE
$if($or($not($stricmp(%album artist%,$meta(%atrist%,0))),$greater($meta_num(artist),1)),$meta_sep(artist,', ',' & '))

This allows for instances where ALBUM ARTIST is not "Various Artists" but it is different from the ARTIST. An example of this would be a greatest hits album by a solo artist with tracks from their band.

Thanks for your help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.