Swapping Mixed Name ListsAs mentioned above, dealing with [Artist] is a bit more challenging, but really quite straightforward in concept. You do the exact same thing, except this time you add in a Checkbox field that lets you turn the swapping function on and off, on a per-Artist basis. Then, you add an [Artist (Smart)] field that has an expression that displays the Artist value either Swapped or Normal, depending on if that box is checked.
Toggle FieldAdd a new field called
Artist Swap Toggle and configure it like this:
Again with the embiggen.Note that the
Relational setting is set to
Store one value for each artist. That makes it so if you check (or uncheck) this box for one file of a particular [Artist], it applies automatically to
all imported files with that same Artist value.
For the
Display Name, you can name it based on how you'd like this toggle to behave, because it can work either way depending on your preference. In other words, when the box is unchecked, do you want the default behavior to be to Swap the value of [Artist] or to pass it through normally? I'd recommend you pick which way you go based on the more common case in your Library. When new files are imported fresh, this custom [Artist Swap Toggle] field will come in with a value of 0 (unchecked). So make that the more common result for you. Then, in the Display boxes, you can put in something like
Swap Artist Name or
Don't Swap Artist (or something that makes sense for how you have it set up).
Smart Artist ReplacementOnce you have this toggle field, you can make the smart [Artist] replacement. Create a new field called
[Artist (smart)], or perhaps
[Album Artist (auto smart)] or something that works for you, and configure it like so:
If you want an unchecked Toggle to swap the Artist value, then use this expression:
If([Artist Swap Toggle],[Artist],Swap([Artist]))&datatype=[list]
If you want it to work on the output of [Album Artist (auto)] instead, then use this instead:
If([Artist Swap Toggle],AlbumArtist(),Swap(AlbumArtist()))&datatype=[list]
If you want it to swap the Artist value only when the toggle is checked, then just reverse the order of the If() statement's results like:
If([Artist Swap Toggle],Swap([Artist]),[Artist])&datatype=[list]
Lastly, display the Toggle field in a column in your Views (and in the Tag Action Window) so that you can enable and disable it as needed, and replace [Album Artist (auto)] or [Artist] as the category you use in each of your Media Views with the new [Artist (smart)] field.
Any time you need to disable the swapping behavior, you can do it by simply checking or unchecking that box. If the swapping works correctly, great. If not, turn it off and pass the regular value through. And, because the toggle is a relational field, you only need to check (or uncheck) the box once per Artist, and the same value will apply to all other files by that same Artist automatically (even ones imported in the future).
Tagging On ImportYou can add even more advanced logic to this if you want. For example, you could add a Regex() pass if you were into it, that looked for things like ampersands or other character patterns that should never trigger the swapping logic.
I'd probably keep the smart field relatively simple, and do things like that in a
Tag on Import rule instead. In a Tag on Import rule, you could check to see if the current [Artist] string starts with "The " or "A ", contains an ampersand, or other special characters unlikely to be part of a proper name. If so, check the Toggle box (or make it unchecked as needed).