output/shout: simplify shout_tag_to_metadata()
This commit is contained in:
parent
981bc85879
commit
4c824e5309
@ -339,27 +339,12 @@ ShoutOutput::Pause()
|
|||||||
static void
|
static void
|
||||||
shout_tag_to_metadata(const Tag &tag, char *dest, size_t size)
|
shout_tag_to_metadata(const Tag &tag, char *dest, size_t size)
|
||||||
{
|
{
|
||||||
char artist[size];
|
const char *artist = tag.GetValue(TAG_ARTIST);
|
||||||
char title[size];
|
const char *title = tag.GetValue(TAG_TITLE);
|
||||||
|
|
||||||
artist[0] = 0;
|
snprintf(dest, size, "%s - %s",
|
||||||
title[0] = 0;
|
artist != nullptr ? artist : "",
|
||||||
|
title != nullptr ? title : "");
|
||||||
for (const auto &item : tag) {
|
|
||||||
switch (item.type) {
|
|
||||||
case TAG_ARTIST:
|
|
||||||
strncpy(artist, item.value, size);
|
|
||||||
break;
|
|
||||||
case TAG_TITLE:
|
|
||||||
strncpy(title, item.value, size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(dest, size, "%s - %s", artist, title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user