tree: smarter artist naming and sorting [1/2]
commitac2f8240119bf06eb72843919e32712308acdcb1
authorGregory Petrosyan <gregory.petrosyan@gmail.com>
Thu, 15 May 2008 01:31:53 +0000 (15 05:31 +0400)
committerTimo Hirvonen <tihirvon@gmail.com>
Sat, 17 May 2008 11:12:03 +0000 (17 14:12 +0300)
tree79347ad4f2e4f3f1cb929a145cc1964cc8edcba7
parente5753b6d11a5d5239654679f3e07125b71fd1560
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>
lib.h
tree.c