summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-02-05 21:48:03 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-02-05 21:48:03 +0100
commit006ec267b2d6372ce547bbfd19df8e5a9bd24886 (patch)
tree10cd3ad6d4c1606315583e9929ac5e3ecba0b17c /playlist.c
parentb06812a7261467785f7fe3f537f010885cfa732f (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.c28
1 files changed, 27 insertions, 1 deletions
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");