core/playlists/generic: Add album sort to the default fields

If we have two albums by the same artist in the same year (such as a CD1
or CD2 postfix), then we'll end up mixing them together when sorting.
Fix this by changing the default sort order to
Artist -> Year -> Album -> Track Number

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2018-04-17 07:49:42 -04:00
parent 5fb46dc663
commit d5b0752497
5 changed files with 5 additions and 3 deletions

View File

@ -56,6 +56,7 @@ void playlist_generic_init_sorted(struct playlist *playlist)
playlist_generic_init(playlist);
playlist_generic_sort(playlist, COMPARE_ARTIST);
playlist_generic_sort(playlist, COMPARE_YEAR);
playlist_generic_sort(playlist, COMPARE_ALBUM);
playlist_generic_sort(playlist, COMPARE_TRACK);
}
}

View File

@ -203,7 +203,7 @@ static void test_sorting()
unsigned int i;
playlist_generic_init_sorted(&p);
g_assert_cmpuint(g_slist_length(p.pl_sort), ==, 3);
g_assert_cmpuint(g_slist_length(p.pl_sort), ==, 4);
playlist_clear_sort(&p);
g_assert_cmpuint(g_slist_length(p.pl_sort), ==, 0);

View File

@ -75,7 +75,7 @@ void test_library()
playlist_set_random(playlist, false);
g_assert_false(playlist->pl_random);
g_assert_cmpuint(g_slist_length(playlist->pl_sort), ==, 3);
g_assert_cmpuint(g_slist_length(playlist->pl_sort), ==, 4);
playlist_clear_sort(playlist);
g_assert_cmpuint(g_slist_length(playlist->pl_sort), ==, 0);
g_assert_true(playlist_sort(playlist, COMPARE_ARTIST));

View File

@ -44,7 +44,7 @@ static void test_init()
if (i == SYS_PL_QUEUED || i == SYS_PL_HISTORY) {
g_assert_cmpuint(g_slist_length(playlist->pl_sort), ==, 0);
} else
g_assert_cmpuint(g_slist_length(playlist->pl_sort), ==, 3);
g_assert_cmpuint(g_slist_length(playlist->pl_sort), ==, 4);
}
/* Add tracks to the collection. */

View File

@ -112,6 +112,7 @@ void test_treeview_sort()
break;
case GUI_MODEL_ARTIST:
case GUI_MODEL_YEAR:
case GUI_MODEL_ALBUM:
case GUI_MODEL_TRACK_NR:
g_assert_true(
gtk_tree_view_column_get_sort_indicator(col));