mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 15:45:56 -05:00
[cfg] Remove hardcoding of strings for unknown album etc
Now configurable, since we don't have real localisation
This commit is contained in:
parent
8d4f99ebf9
commit
de1b1c3805
@ -90,6 +90,11 @@ static cfg_opt_t sec_library[] =
|
||||
CFG_STR("name_podcasts", "Podcasts", CFGF_NONE),
|
||||
CFG_STR("name_audiobooks", "Audiobooks", CFGF_NONE),
|
||||
CFG_STR("name_radio", "Radio", CFGF_NONE),
|
||||
CFG_STR("name_unknown_title", "Unknown title", CFGF_NONE),
|
||||
CFG_STR("name_unknown_artist", "Unknown artist", CFGF_NONE),
|
||||
CFG_STR("name_unknown_album", "Unknown album", CFGF_NONE),
|
||||
CFG_STR("name_unknown_genre", "Unknown genre", CFGF_NONE),
|
||||
CFG_STR("name_unknown_composer", "Unknown composer", CFGF_NONE),
|
||||
CFG_STR_LIST("artwork_basenames", "{artwork,cover,Folder}", CFGF_NONE),
|
||||
CFG_BOOL("artwork_individual", cfg_false, CFGF_NONE),
|
||||
CFG_STR_LIST("artwork_online_sources", NULL, CFGF_NONE),
|
||||
|
@ -9,6 +9,13 @@
|
||||
|
||||
#define CONFFILE CONFDIR "/forked-daapd.conf"
|
||||
|
||||
// Some shorthand macros for poor man's
|
||||
#define CFG_NAME_UNKNOWN_TITLE (cfg_getstr(cfg_getsec(cfg, "library"), "name_unknown_title"))
|
||||
#define CFG_NAME_UNKNOWN_ARTIST (cfg_getstr(cfg_getsec(cfg, "library"), "name_unknown_artist"))
|
||||
#define CFG_NAME_UNKNOWN_ALBUM (cfg_getstr(cfg_getsec(cfg, "library"), "name_unknown_album"))
|
||||
#define CFG_NAME_UNKNOWN_GENRE (cfg_getstr(cfg_getsec(cfg, "library"), "name_unknown_genre"))
|
||||
#define CFG_NAME_UNKNOWN_COMPOSER (cfg_getstr(cfg_getsec(cfg, "library"), "name_unknown_composer"))
|
||||
|
||||
extern cfg_t *cfg;
|
||||
extern uint64_t libhash;
|
||||
extern uid_t runas_uid;
|
||||
|
10
src/db.c
10
src/db.c
@ -907,7 +907,7 @@ fixup_defaults(char **tag, enum fixup_type fixup, struct fixup_ctx *ctx)
|
||||
else if (ctx->queue_item && ctx->queue_item->path)
|
||||
*tag = strdup(ctx->queue_item->path);
|
||||
else
|
||||
*tag = strdup("Unknown title");
|
||||
*tag = strdup(CFG_NAME_UNKNOWN_TITLE);
|
||||
break;
|
||||
|
||||
case DB_FIXUP_ARTIST:
|
||||
@ -925,7 +925,7 @@ fixup_defaults(char **tag, enum fixup_type fixup, struct fixup_ctx *ctx)
|
||||
else if (ctx->mfi && ctx->mfi->tv_series_name)
|
||||
*tag = strdup(ctx->mfi->tv_series_name);
|
||||
else
|
||||
*tag = strdup("Unknown artist");
|
||||
*tag = strdup(CFG_NAME_UNKNOWN_ARTIST);
|
||||
break;
|
||||
|
||||
case DB_FIXUP_ALBUM:
|
||||
@ -935,7 +935,7 @@ fixup_defaults(char **tag, enum fixup_type fixup, struct fixup_ctx *ctx)
|
||||
if (ctx->mfi && ctx->mfi->tv_series_name)
|
||||
*tag = safe_asprintf("%s, Season %u", ctx->mfi->tv_series_name, ctx->mfi->tv_season_num);
|
||||
else
|
||||
*tag = strdup("Unknown album");
|
||||
*tag = strdup(CFG_NAME_UNKNOWN_ALBUM);
|
||||
break;
|
||||
|
||||
case DB_FIXUP_ALBUM_ARTIST: // Will be set after artist, because artist (must) come first in the col_maps
|
||||
@ -955,14 +955,14 @@ fixup_defaults(char **tag, enum fixup_type fixup, struct fixup_ctx *ctx)
|
||||
else if (ctx->queue_item && ctx->queue_item->artist)
|
||||
*tag = strdup(ctx->queue_item->artist);
|
||||
else
|
||||
*tag = strdup("Unknown artist");
|
||||
*tag = strdup(CFG_NAME_UNKNOWN_ARTIST);
|
||||
break;
|
||||
|
||||
case DB_FIXUP_GENRE:
|
||||
if (*tag)
|
||||
break;
|
||||
|
||||
*tag = strdup("Unknown genre");
|
||||
*tag = strdup(CFG_NAME_UNKNOWN_GENRE);
|
||||
break;
|
||||
|
||||
case DB_FIXUP_MEDIA_KIND:
|
||||
|
@ -150,22 +150,8 @@ static struct event *seek_timer;
|
||||
static int seek_target;
|
||||
|
||||
/* If an item is removed from the library while in the queue, we replace it with this */
|
||||
static struct media_file_info dummy_mfi =
|
||||
{
|
||||
.id = DB_MEDIA_FILE_NON_PERSISTENT_ID,
|
||||
.title = "(unknown title)",
|
||||
.artist = "(unknown artist)",
|
||||
.album = "(unknown album)",
|
||||
.genre = "(unknown genre)",
|
||||
};
|
||||
static struct db_queue_item dummy_queue_item =
|
||||
{
|
||||
.file_id = DB_MEDIA_FILE_NON_PERSISTENT_ID,
|
||||
.title = "(unknown title)",
|
||||
.artist = "(unknown artist)",
|
||||
.album = "(unknown album)",
|
||||
.genre = "(unknown genre)",
|
||||
};
|
||||
static struct media_file_info dummy_mfi;
|
||||
static struct db_queue_item dummy_queue_item;
|
||||
|
||||
|
||||
/* -------------------------------- HELPERS --------------------------------- */
|
||||
@ -2909,6 +2895,18 @@ dacp_init(void)
|
||||
current_rev = 2;
|
||||
update_requests = NULL;
|
||||
|
||||
dummy_mfi.id = DB_MEDIA_FILE_NON_PERSISTENT_ID;
|
||||
dummy_mfi.title = CFG_NAME_UNKNOWN_TITLE;
|
||||
dummy_mfi.artist = CFG_NAME_UNKNOWN_ARTIST;
|
||||
dummy_mfi.album = CFG_NAME_UNKNOWN_ALBUM;
|
||||
dummy_mfi.genre = CFG_NAME_UNKNOWN_GENRE;
|
||||
|
||||
dummy_queue_item.file_id = DB_MEDIA_FILE_NON_PERSISTENT_ID;
|
||||
dummy_queue_item.title = CFG_NAME_UNKNOWN_TITLE;
|
||||
dummy_queue_item.artist = CFG_NAME_UNKNOWN_ARTIST;
|
||||
dummy_queue_item.album = CFG_NAME_UNKNOWN_ALBUM;
|
||||
dummy_queue_item.genre = CFG_NAME_UNKNOWN_GENRE;
|
||||
|
||||
#ifdef HAVE_EVENTFD
|
||||
update_efd = eventfd(0, EFD_CLOEXEC);
|
||||
if (update_efd < 0)
|
||||
|
@ -277,7 +277,7 @@ scrobble(int id)
|
||||
goto noscrobble;
|
||||
|
||||
// Don't scrobble songs with unknown artist
|
||||
if (strcmp(mfi->artist, "Unknown artist") == 0)
|
||||
if (strcmp(mfi->artist, CFG_NAME_UNKNOWN_ARTIST) == 0)
|
||||
goto noscrobble;
|
||||
|
||||
kv = keyval_alloc();
|
||||
|
@ -545,7 +545,7 @@ process_track_file(plist_t trk)
|
||||
/* Don't let album_artist set to "Unknown artist" if we've
|
||||
* filled artist from the iTunes data in the meantime
|
||||
*/
|
||||
if (strcmp(mfi->album_artist, "Unknown artist") == 0)
|
||||
if (strcmp(mfi->album_artist, CFG_NAME_UNKNOWN_ARTIST) == 0)
|
||||
{
|
||||
free(mfi->album_artist);
|
||||
mfi->album_artist = strdup(mfi->artist);
|
||||
|
Loading…
Reference in New Issue
Block a user