From 6e58af75cf4f7953684c49ff09835cd8fdbde05b Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 12 Dec 2015 23:28:48 +0100 Subject: [PATCH] [http_daapd] Add option to hide albums/artists with just one track --- forked-daapd.conf | 6 ++++++ src/conffile.c | 1 + src/httpd_daap.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/forked-daapd.conf b/forked-daapd.conf index 41be9b66..78914a48 100644 --- a/forked-daapd.conf +++ b/forked-daapd.conf @@ -78,6 +78,12 @@ library { # (changing this setting only takes effect after rescan, see the README) compilation_artist = "Various artists" + # If your album and artist lists are cluttered, you can choose to hide + # albums and artists with only one track. The tracks will still be + # visible in other lists, e.g. songs and playlists. This setting + # currently only works in some remotes. +# hide_singles = false + # Internet streams in your playlists will by default be shown in the # "Radio" library, like iTunes does. However, some clients (like # TunesRemote+) won't show the "Radio" library. If you would also like diff --git a/src/conffile.c b/src/conffile.c index 54ce009f..e4b264a7 100644 --- a/src/conffile.c +++ b/src/conffile.c @@ -69,6 +69,7 @@ static cfg_opt_t sec_library[] = CFG_STR_LIST("audiobooks", NULL, CFGF_NONE), CFG_STR_LIST("compilations", NULL, CFGF_NONE), CFG_STR("compilation_artist", NULL, CFGF_NONE), + CFG_BOOL("hide_singles", cfg_false, CFGF_NONE), CFG_BOOL("radio_playlists", cfg_false, CFGF_NONE), CFG_STR("name_library", "Library", CFGF_NONE), CFG_STR("name_music", "Music", CFGF_NONE), diff --git a/src/httpd_daap.c b/src/httpd_daap.c index 44629bb8..719855a1 100644 --- a/src/httpd_daap.c +++ b/src/httpd_daap.c @@ -1848,6 +1848,7 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri const struct dmap_field *df; const struct dmap_field **meta; struct sort_ctx *sctx; + cfg_t *lib; const char *param; char **strval; char *tag; @@ -1979,6 +1980,11 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri if (strlen(dbgri.itemname) == 0) continue; + /* Don't add single item albums/artists if configured to hide */ + lib = cfg_getsec(cfg, "library"); + if (cfg_getbool(lib, "hide_singles") && (strcmp(dbgri.itemcount, "1") == 0)) + continue; + ngrp++; for (i = 0; i < nmeta; i++)