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: Using $swapprefix for bands that start with "*" (Read 1448 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Using $swapprefix for bands that start with "*"

I have a couple bands in my Library that start their name with an asterisk. I've tried specifying the prefix like this: $swapprefix(%artist%,a,the,*)  but it doesn't work. Is there any way to make this work? I'm guessing since the asterisk doesn't have a space between it and the rest of the name, the $swapprefix code wouldn't work.

Using $swapprefix for bands that start with "*"

Reply #1
Can you use it between " "?
Windows 10 Pro x64 // foobar2000 1.3.10

Using $swapprefix for bands that start with "*"

Reply #2
Code: [Select]
$swapprefix($if($stricmp($left(%artist%,1),*),$insert(%artist%, ,1),%artist%),a,the,*)
This inserts a whitespace after the asterisk, but only if the asterisk is the first character of the string, %artist% otherwise, and uses that for the evaluation of $swapprefix. I just now realized that it still adds a whitespace if the asterisk already has one, but hopefully you can solve this yourself, if it is a problem at all.
It's only audiophile if it's inconvenient.

Using $swapprefix for bands that start with "*"

Reply #3
Code: [Select]
$swapprefix($if($stricmp($left(%artist%,1),*),$insert(%artist%, ,1),%artist%),a,the,*)
This inserts a whitespace after the asterisk, but only if the asterisk is the first character of the string, %artist% otherwise, and uses that for the evaluation of $swapprefix. I just now realized that it still adds a whitespace if the asterisk already has one, but hopefully you can solve this yourself, if it is a problem at all.

This worked! Thanks.

 

Using $swapprefix for bands that start with "*"

Reply #4
Another way of managing names containing prefixes ——should I display prefix first? ....should I display last? ...should I remove?—— is to display all possible variations!

You have some music files from an artist known as:
Quote
* Wildcard


You create a multiple value <ARTIST NAME> tag string which you split using the semicolon:
Quote
* Wildcard; Wildcard, *; Wildcard; Band = * Wildcard


You create a Library Viewer Filter column named "Artist" and use this display syntax:
Quote
%<artist>%


While browsing the Library Viewer Filter column named "Artist" you will see 4 separate items listed in alphabetical order:
Quote
. . .
. . .
* Wildcard
. . .
. . .
Band = * Wildcard
. . .
. . .
Wildcard
. . .
. . .
Wildcard, *
. . .
. . .


In your Playlist Viewer, if you use a Grouping display string which starts with ARTIST (or ALBUM ARTIST) then choose one name/value from the ARTIST (or ALBUM ARTIST) tag.
If you use this title-formatting syntax:    $if2($meta(album artist,0),$meta(artist,0))    then your Playlist Viewer Grouping will . . . Display the ALBUM ARTIST tag string and choose the first value if there are multiple values, ELSE display the ARTIST tag and choose the first value if there are multiple values.

Therefore, when using such a display scheme for your foobar2000, it is good practice to do two things:    (1) Always create an ALBUM ARTIST tag using the string YOU prefer to see displayed in the Playlist Viewer Grouping.    (2) Always make the first value in the (multi-value) ARTIST tag the same as the ALBUM ARTIST tag.

What I described is the way I manage titles and text variations in my own foobar2000; I don't like the $swapprefix method.

P.S. -- One case where you may run into problems with this method is if you like displaying %TRACK ARTIST% tags. Therefore we DO NOT use the %TRACK ARTIST% tag, and instead, we prefix the track artist string to the track title tag string.     Example:   instead of this track title tag string: Song Number 4    we use this: * Wildcard — Song Number 4
Another way is to use the 1st value of the ARTIST tag, ie: $meta(artist,0) instead of %track artist%