tree: smarter artist naming and sorting [1/2]
The problem with current artists' display name selection algorithm
is that we end up using a mix of "artist", "artistsort", etc. names.
While using "artistsort" etc. if possible is a good thing,
displaying something like
"The Beatles"
...
...
"Prodigy, The"
or even
"The Prodigy"
"Prodigy, The"
is really ugly.
This patch does several things:
- introduce raw_name in struct artist
raw_name is always initialised to "artist" value
(including <No Name>, etc.)
- when searching for an artist in tree, compare
raw_names after striping starting "The " off, if any
- when adding new artist to the tree, and no
pretty artist name ("artistsort", etc.) is available,
transform names like "The Beatles" into "Beatles, The".
This fixes the most common scenario, if pretty name is missing.
Case when (possibly pre-formatted) raw name is not replaced
with pretty one will be addressed in separate patch.
Signed-off-by: Gregory Petrosyan <gregory.petrosyan@gmail.com>