Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Need help with these strings (Read 2079 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Need help with these strings

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?

Need help with these strings

Reply #1
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.

Need help with these strings

Reply #2
@aron: I you have a look at the start of the guessing code in my "dynamic" 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.