Make hiding internet streams from normal playlists configurable

This commit is contained in:
ejurgensen 2015-03-30 21:10:59 +02:00
parent 41f39ea5ca
commit 4850423118
3 changed files with 21 additions and 4 deletions

@ -78,14 +78,21 @@ library {
# (changing this setting only takes effect after rescan, see the README) # (changing this setting only takes effect after rescan, see the README)
compilation_artist = "Various artists" compilation_artist = "Various artists"
# There are 5 default playlists: "Library", "Music", "Movies", "TV Shows" # Internet streams in your playlists will by default be shown in the
# and "Podcasts". Here you can change the names of these playlists. # "Radio" library, like iTunes does. However, some clients (like
# TunesRemote+) won't show the "Radio" library. If you would also like
# to have them shown like normal playlists, you can enable this option.
# radio_playlists = false
# These are the default playlists. If you want them to have other names,
# you can set it here.
# name_library = "Library" # name_library = "Library"
# name_music = "Music" # name_music = "Music"
# name_movies = "Movies" # name_movies = "Movies"
# name_tvshows = "TV Shows" # name_tvshows = "TV Shows"
# name_podcasts = "Podcasts" # name_podcasts = "Podcasts"
# name_audiobooks = "Audiobooks" # name_audiobooks = "Audiobooks"
# name_radio = "Radio"
# Artwork file names (without file type extension) # Artwork file names (without file type extension)
# forked-daapd will look for jpg and png files with these base names # forked-daapd will look for jpg and png files with these base names

@ -69,12 +69,14 @@ static cfg_opt_t sec_library[] =
CFG_STR_LIST("audiobooks", NULL, CFGF_NONE), CFG_STR_LIST("audiobooks", NULL, CFGF_NONE),
CFG_STR_LIST("compilations", NULL, CFGF_NONE), CFG_STR_LIST("compilations", NULL, CFGF_NONE),
CFG_STR("compilation_artist", NULL, CFGF_NONE), CFG_STR("compilation_artist", NULL, CFGF_NONE),
CFG_BOOL("radio_playlists", cfg_false, CFGF_NONE),
CFG_STR("name_library", "Library", CFGF_NONE), CFG_STR("name_library", "Library", CFGF_NONE),
CFG_STR("name_music", "Music", CFGF_NONE), CFG_STR("name_music", "Music", CFGF_NONE),
CFG_STR("name_movies", "Movies", CFGF_NONE), CFG_STR("name_movies", "Movies", CFGF_NONE),
CFG_STR("name_tvshows", "TV Shows", CFGF_NONE), CFG_STR("name_tvshows", "TV Shows", CFGF_NONE),
CFG_STR("name_podcasts", "Podcasts", CFGF_NONE), CFG_STR("name_podcasts", "Podcasts", CFGF_NONE),
CFG_STR("name_audiobooks", "Audiobooks", CFGF_NONE), CFG_STR("name_audiobooks", "Audiobooks", CFGF_NONE),
CFG_STR("name_radio", "Radio", CFGF_NONE),
CFG_STR_LIST("artwork_basenames", "{artwork,cover,Folder}", CFGF_NONE), CFG_STR_LIST("artwork_basenames", "{artwork,cover,Folder}", CFGF_NONE),
CFG_BOOL("artwork_individual", cfg_false, CFGF_NONE), CFG_BOOL("artwork_individual", cfg_false, CFGF_NONE),
CFG_STR_LIST("filetypes_ignore", "{.db,.ini,.db-journal,.pdf}", CFGF_NONE), CFG_STR_LIST("filetypes_ignore", "{.db,.ini,.db-journal,.pdf}", CFGF_NONE),

@ -69,6 +69,7 @@ extern struct event_base *evbase_httpd;
/* Update requests refresh interval in seconds */ /* Update requests refresh interval in seconds */
#define DAAP_UPDATE_REFRESH 0 #define DAAP_UPDATE_REFRESH 0
/* Database number for the Radio item */
#define DAAP_DB_RADIO 2 #define DAAP_DB_RADIO 2
struct uri_map { struct uri_map {
@ -1128,6 +1129,7 @@ daap_reply_dblist(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
struct daap_session *s; struct daap_session *s;
cfg_t *lib; cfg_t *lib;
char *name; char *name;
char *name_radio;
int count; int count;
s = daap_session_find(req, query, evbuf); s = daap_session_find(req, query, evbuf);
@ -1136,6 +1138,7 @@ daap_reply_dblist(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
lib = cfg_getsec(cfg, "library"); lib = cfg_getsec(cfg, "library");
name = cfg_getstr(lib, "name"); name = cfg_getstr(lib, "name");
name_radio = cfg_getstr(lib, "name_radio");
content = evbuffer_new(); content = evbuffer_new();
if (!content) if (!content)
@ -1187,7 +1190,7 @@ daap_reply_dblist(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
dmap_add_long(item, "mper", DAAP_DB_RADIO); dmap_add_long(item, "mper", DAAP_DB_RADIO);
dmap_add_int(item, "mdbk", 0x64); dmap_add_int(item, "mdbk", 0x64);
dmap_add_int(item, "aeCs", 0); dmap_add_int(item, "aeCs", 0);
dmap_add_string(item, "minm", "Radio"); dmap_add_string(item, "minm", name_radio);
count = db_pl_get_count(); // TODO This counts too much, should only include stream playlists count = db_pl_get_count(); // TODO This counts too much, should only include stream playlists
dmap_add_int(item, "mimc", count); dmap_add_int(item, "mimc", count);
dmap_add_int(item, "mctc", 0); dmap_add_int(item, "mctc", 0);
@ -1545,12 +1548,14 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char **
struct daap_session *s; struct daap_session *s;
struct evbuffer *playlistlist; struct evbuffer *playlistlist;
struct evbuffer *playlist; struct evbuffer *playlist;
cfg_t *lib;
const struct dmap_field_map *dfm; const struct dmap_field_map *dfm;
const struct dmap_field *df; const struct dmap_field *df;
const struct dmap_field **meta; const struct dmap_field **meta;
const char *param; const char *param;
char **strval; char **strval;
int database; int database;
int cfg_radiopl;
int nmeta; int nmeta;
int npls; int npls;
int32_t plid; int32_t plid;
@ -1573,6 +1578,9 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char **
return -1; return -1;
} }
lib = cfg_getsec(cfg, "library");
cfg_radiopl = cfg_getbool(lib, "radio_playlists");
ret = evbuffer_expand(evbuf, 61); ret = evbuffer_expand(evbuf, 61);
if (ret < 0) if (ret < 0)
{ {
@ -1674,7 +1682,7 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char **
*/ */
if ((database == DAAP_DB_RADIO) && (plstreams == 0)) if ((database == DAAP_DB_RADIO) && (plstreams == 0))
continue; continue;
if ((database != DAAP_DB_RADIO) && (plstreams > 0) && (plstreams == plitems)) if (!cfg_radiopl && (database != DAAP_DB_RADIO) && (plstreams > 0) && (plstreams == plitems))
continue; continue;
/* Don't add empty Smart playlists */ /* Don't add empty Smart playlists */