diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-02-05 21:48:03 +0100 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-02-05 21:48:03 +0100 |
commit | 006ec267b2d6372ce547bbfd19df8e5a9bd24886 (patch) | |
tree | 10cd3ad6d4c1606315583e9929ac5e3ecba0b17c /playlist.c | |
parent | b06812a7261467785f7fe3f537f010885cfa732f (diff) |
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
Diffstat (limited to 'playlist.c')
-rw-r--r-- | playlist.c | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -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"); |