Make playlist ignore articles when sorting (#202)

This is more correct, and the other way is driving me crazy.
This commit is contained in:
Gavin D. Howard
2019-07-04 16:13:51 -06:00
committed by Jonas Kvinge
parent 64750025f6
commit 5cde33711e
4 changed files with 50 additions and 26 deletions

View File

@@ -1286,14 +1286,12 @@ QString CollectionModel::SortTextForArtist(QString artist) {
artist = SortText(artist);
if (artist.startsWith("the ")) {
artist = artist.right(artist.length() - 4) + ", the";
}
else if (artist.startsWith("a ")) {
artist = artist.right(artist.length() - 2) + ", a";
}
else if (artist.startsWith("an ")) {
artist = artist.right(artist.length() - 3) + ", an";
for (const auto &i : Song::kArticles) {
if (artist.startsWith(i)) {
int ilen = i.length();
artist = artist.right(artist.length() - ilen) + ", " + i.left(ilen - 1);
break;
}
}
return artist;