HydrogenAudio

Hosted Forums => foobar2000 => Support - (fb2k) => Topic started by: aron on 2004-03-08 08:52:05

Title: Need help with these strings
Post by: aron on 2004-03-08 08:52:05
i need some help making a change to my formatting. i've tried to make the changes, but i just can't seem to get them right.

my current formatting does the following:

-- if (OST) is present at the end of the directory name, the album is assumed to be an ORIGINAL SOUNDTRACK.

-- if the first 3 characters of the ARTIST are not the same as the first three characters of the directory, the album is assumed to be by VARIOUS ARTISTS.

the formatting goes as follows:

Code: [Select]
$if($strcmp($num(%tracknumber%,1),1),

$if($stricmp($right(%_directoryname%,5),'(OST)'),
$get(color_art)'Original Soundtrack',

$if($not($stricmp($left(%artist%,3),$left(%_directoryname%,3))),
$get(color_art)'Various Artists',

$get(color_art)%Artist%))
$get(color_gri)$repeat('—',100),)


what i want to do, however, is make the following exception to the VARIOUS ARTIST naming:

-- if the album is in a folder starting with "CD" or "DISC", then i want it to do the same check (match first 3 characters of dir against artist) to the directory above.

i tried this:

Code: [Select]
$if($strcmp($num(%tracknumber%,1),1),

$if($stricmp($right(%_directoryname%,5),'(OST)'),
$get(color_art)'Original Soundtrack',

$if($not($stricmp($left(%artist%,3),$left(%_directoryname%,3))),

$if($stricmp($left(%_directoryname%,2),'CD'),
$if($not($stricmp($left(%artist%,3),$left($directory(%_path%,2),3))),
$get(color_art)'Various Artists',

$if($stricmp($left(%_directoryname%,4),'disc'),
$if($not($stricmp($left(%artist%,3),$left($directory(%_path%,2),3))),

$get(color_art)'Various Artists',


$get(color_art)%artist%))))))
$get(color_gri)$repeat('—',100),)


...but it doesn't work. can anyone help me make the desired changes to the first chunk of code?
Title: Need help with these strings
Post by: picmixer on 2004-03-08 14:09:18
The problem is that the first $if comparison for OST will override the last $if comparison for OST and "DISC".

One way to work around this is to already make an exception for the "disc" guesing in the first $if string for OST guessing.

Something like
Code: [Select]
$if($and($stricmp($right(%_directoryname%,5),'(OST)'),$not($stricmp($left(%_directoryname%,4),'disc')))
$get(color_art)'Original Soundtrack',
should most likely work.

Also I assume you are using
Code: [Select]
$if($strcmp($num(%tracknumber%,1),1),
for some kind of album based formatting.

You might want to look into the $select function and use that for albumbased formatting instead of $if......

Something like
Code: [Select]
$select($min(X,%tracknumber%),
usually works quite well on album based formattings.  Simply replace X by the last tracknumber you need any special formatting for.
Title: Need help with these strings
Post by: upNorth on 2004-03-08 21:31:06
@aron: I you have a look at the start of the guessing code in my "dynamic (http://pelit.koillismaa.fi/fb2k/strings.php?f=40)" formatting you might find something useful. There is some code there that will adjust the directory level used to look for artist and album name, depending on the presens of a "cd" or "disc" directory.
The relevant part starts at line 190, and you can see an example of it's usage on line 250.