Skip to content

Instantly share code, notes, and snippets.

@lanpai
Created April 21, 2019 20:55
Show Gist options
  • Save lanpai/f949c9459d892049e9ad8076a260c790 to your computer and use it in GitHub Desktop.
Save lanpai/f949c9459d892049e9ad8076a260c790 to your computer and use it in GitHub Desktop.
Patch for cmus which hackily enables album sorting over artist sorting in the tree view
diff --git a/comment.c b/comment.c
index 13ba7f0..4b3894d 100644
--- a/comment.c
+++ b/comment.c
@@ -60,7 +60,7 @@ int track_is_compilation(const struct keyval *comments)
int track_is_va_compilation(const struct keyval *comments)
{
- const char *c, *a, *aa;
+ /*const char *c, *a, *aa;
aa = keyvals_get_val(comments, "albumartist");
if (aa)
@@ -76,38 +76,39 @@ int track_is_va_compilation(const struct keyval *comments)
c = keyvals_get_val(comments, "partofacompilation");
if (c && is_freeform_true(c))
- return 1;
+ return 1;*/
return 0;
}
const char *comments_get_albumartist(const struct keyval *comments)
{
- const char *val = keyvals_get_val(comments, "albumartist");
+ /*const char *val = keyvals_get_val(comments, "albumartist");
if (!val || strcmp(val, "") == 0)
val = keyvals_get_val(comments, "artist");
- return val;
+ return val;*/
+ return "<Various Albums>";
}
const char *comments_get_artistsort(const struct keyval *comments)
{
- const char *val;
+ //const char *val;
- if (track_is_va_compilation(comments))
- return NULL;
+ /*if (track_is_va_compilation(comments))
+ return NULL;*/
- val = keyvals_get_val(comments, "albumartistsort");
- if (!track_is_compilation(comments)) {
+ //val = keyvals_get_val(comments, "albumartistsort");
+ /*if (!track_is_compilation(comments)) {
if (!val || strcmp(val, "") == 0)
val = keyvals_get_val(comments, "artistsort");
}
if (!val || strcmp(val, "") == 0)
- return NULL;
+ return NULL;*/
- return val;
+ return NULL;
}
int comments_get_int(const struct keyval *comments, const char *key)
diff --git a/tree.c b/tree.c
index 7cad3e3..311077e 100644
--- a/tree.c
+++ b/tree.c
@@ -519,7 +519,7 @@ static struct artist *artist_new(const char *name, const char *sort_name, int is
a->collkey_name = u_strcasecoll_key(a->name);
a->collkey_sort_name = u_strcasecoll_key0(a->sort_name);
a->collkey_auto_sort_name = u_strcasecoll_key0(a->auto_sort_name);
- a->expanded = 0;
+ a->expanded = 1;
a->is_compilation = is_compilation;
rb_root_init(&a->album_root);
diff --git a/ui_curses.c b/ui_curses.c
index 564b205..b356ae1 100644
--- a/ui_curses.c
+++ b/ui_curses.c
@@ -1014,7 +1014,7 @@ static void update_window(struct window *win, int x, int y, int w, const char *t
static void update_tree_window(void)
{
update_window(lib_tree_win, tree_win_x, 0, tree_win_w,
- "Artist / Album", print_tree);
+ "Album", print_tree);
}
static void update_track_window(void)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment