mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 07:05:57 -05:00
Configurable library names
Names of Library, Music, Movies, TV Shows and Podcasts made configurable
This commit is contained in:
parent
adc9c03763
commit
414817031d
@ -44,6 +44,14 @@ library {
|
||||
# a single name which will be used for all music in the compilation dir
|
||||
compilation_artist = "Various artists"
|
||||
|
||||
# There are 5 default playlists: "Library", "Music", "Movies", "TV Shows"
|
||||
# and "Podcasts". Here you can change the names of these playlists.
|
||||
# name_library = "Library"
|
||||
# name_music = "Music"
|
||||
# name_movies = "Movies"
|
||||
# name_tvshows = "TV Shows"
|
||||
# name_podcasts = "Podcasts"
|
||||
|
||||
# Artwork file names (without file type extension)
|
||||
# forked-daapd will look for jpg and png files with these base names
|
||||
# artwork_basenames = { "artwork", "cover", "Folder" }
|
||||
|
@ -63,6 +63,11 @@ static cfg_opt_t sec_library[] =
|
||||
CFG_STR_LIST("podcasts", NULL, CFGF_NONE),
|
||||
CFG_STR_LIST("compilations", NULL, CFGF_NONE),
|
||||
CFG_STR("compilation_artist", NULL, CFGF_NONE),
|
||||
CFG_STR("name_library", "Library", CFGF_NONE),
|
||||
CFG_STR("name_music", "Music", CFGF_NONE),
|
||||
CFG_STR("name_movies", "Movies", CFGF_NONE),
|
||||
CFG_STR("name_tvshows", "TV Shows", CFGF_NONE),
|
||||
CFG_STR("name_podcasts", "Podcasts", CFGF_NONE),
|
||||
CFG_STR_LIST("artwork_basenames", "{artwork,cover,Folder}", CFGF_NONE),
|
||||
CFG_STR_LIST("filetypes_ignore", "{.db,.ini}", CFGF_NONE),
|
||||
CFG_BOOL("itunes_overrides", cfg_false, CFGF_NONE),
|
||||
|
51
src/db.c
51
src/db.c
@ -588,6 +588,55 @@ db_analyze(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Set names of default playlists according to config */
|
||||
static void
|
||||
db_set_cfg_names(void)
|
||||
{
|
||||
#define Q_TMPL "UPDATE playlists SET title = '%q' WHERE type = 1 AND special_id = %d;"
|
||||
char *cfg_item[5] = { "name_library", "name_music", "name_movies", "name_tvshows", "name_podcasts" };
|
||||
char special_id[5] = { 0, 6, 4, 5, 1 };
|
||||
cfg_t *lib;
|
||||
char *query;
|
||||
char *title;
|
||||
char *errmsg;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
lib = cfg_getsec(cfg, "library");
|
||||
|
||||
for (i = 0; i < (sizeof(cfg_item) / sizeof(cfg_item[0])); i++)
|
||||
{
|
||||
title = cfg_getstr(lib, cfg_item[i]);
|
||||
if (!title)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DB, "Internal error, unknown config item '%s'\n", cfg_item[i]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
query = sqlite3_mprintf(Q_TMPL, title, special_id[i]);
|
||||
if (!query)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DB, "Out of memory for query string\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ret = db_exec(query, &errmsg);
|
||||
if (ret != SQLITE_OK)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DB, "Error setting playlist title, query %s, error: %s\n", query, errmsg);
|
||||
|
||||
sqlite3_free(errmsg);
|
||||
}
|
||||
else
|
||||
DPRINTF(E_DBG, L_DB, "Playlist title for config item '%s' set with query '%s'\n", cfg_item[i], query);
|
||||
|
||||
sqlite3_free(query);
|
||||
}
|
||||
#undef Q_TMPL
|
||||
}
|
||||
|
||||
void
|
||||
db_hook_post_scan(void)
|
||||
{
|
||||
@ -4989,6 +5038,8 @@ db_init(void)
|
||||
|
||||
db_analyze();
|
||||
|
||||
db_set_cfg_names();
|
||||
|
||||
files = db_files_get_count();
|
||||
pls = db_pl_get_count();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user