From 006ec267b2d6372ce547bbfd19df8e5a9bd24886 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 5 Feb 2014 21:48:03 +0100 Subject: experimental: added support for DDB:CUSTOM_TITLE metadata, for setting radio station titles new text field in the Add Location dialog automatically use in title formatting for %B and %a --- playlist.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'playlist.c') diff --git a/playlist.c b/playlist.c index 27330ca7..62b97d30 100644 --- a/playlist.c +++ b/playlist.c @@ -2913,9 +2913,22 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } else if (*fmt == 'a') { meta = pl_find_meta_raw (it, "artist"); - if (!meta) { + const char *custom = pl_find_meta_raw (it, "DDB:CUSTOM_TITLE"); + if (!meta && !custom) { meta = "Unknown artist"; } + + if (custom) { + if (!meta) { + meta = custom; + } + else { + int l = strlen (custom) + strlen (meta) + 4; + char *out = alloca (l); + snprintf (out, l, "[%s] %s", custom, meta); + meta = out; + } + } } else if (*fmt == 't') { meta = pl_find_meta_raw (it, "title"); @@ -2963,6 +2976,19 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } } } + + const char *custom = pl_find_meta_raw (it, "DDB:CUSTOM_TITLE"); + if (custom) { + if (!meta) { + meta = custom; + } + else { + int l = strlen (custom) + strlen (meta) + 4; + char *out = alloca (l); + snprintf (out, l, "[%s] %s", custom, meta); + meta = out; + } + } } else if (*fmt == 'C') { meta = pl_find_meta_raw (it, "composer"); -- cgit v1.2.3