[http_daapd] Add option to hide albums/artists with just one track

This commit is contained in:
ejurgensen 2015-12-12 23:28:48 +01:00
parent cb9034bee7
commit 6e58af75cf
3 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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),

View File

@ -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++)