Conditional statements in foobar2000 sort syntax

My music files are tagged with some custom tags, which for some reason aren't entirely standardized. This is probably due to some peculiarity with my MusicBrainz Picard set-up, but that is beside the point.

Anyway, when sorting by tags that should be equivalent, I would like each track to be sorted by the one tag it actually has. My approach is:

$if3(%albumartistsortorder%, %albumartistsort%) $if3(%original release date%, %date%) %album% %disc% %track%

What appears to happen instead is that the sort just ignores the conditions and reads the tag fields (including the parameters) as if there were no $if3() there.

A second approach is to write my own field remappings. According to this guide, the %artist% field is actually short for

$if3($meta(artist),$meta(album artist),$meta(composer),$meta(performer))

If I could define my own mappings like this, this would solve my problem. Is this possible, or what else can I do?

1 Answer

Actually, conditional statements work just fine in sort strings. However, $if3() should have its arguments separated with commas and nothing else. Using spaces caused various confusing problems. A working sort string is:

$if3(%albumartistsortorder%,%albumartistsort%,%artistsortorder%,%album artist%) $if3(%original release date%,%date%) %album% %disc% %track%

This is the same string as the one in the question, with proper syntax. It also uses %artistsortorder% and %album artist% as fallback fields for where there is no sorted album artist.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like