diff options
Diffstat (limited to 'src/TagPrint.cxx')
-rw-r--r-- | src/TagPrint.cxx | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/TagPrint.cxx b/src/TagPrint.cxx index 1191bd37c..4937fa622 100644 --- a/src/TagPrint.cxx +++ b/src/TagPrint.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,8 +21,9 @@ #include "TagPrint.hxx" #include "tag/Tag.hxx" #include "tag/TagSettings.h" -#include "Song.hxx" -#include "Client.hxx" +#include "client/Client.hxx" + +#define SONG_TIME "Time: " void tag_print_types(Client &client) { @@ -35,14 +36,24 @@ void tag_print_types(Client &client) } } -void tag_print(Client &client, const Tag &tag) +void +tag_print(Client &client, TagType type, const char *value) { - if (tag.time >= 0) - client_printf(client, SONG_TIME "%i\n", tag.time); + client_printf(client, "%s: %s\n", tag_item_names[type], value); +} - for (unsigned i = 0; i < tag.num_items; i++) { +void +tag_print_values(Client &client, const Tag &tag) +{ + for (const auto &i : tag) client_printf(client, "%s: %s\n", - tag_item_names[tag.items[i]->type], - tag.items[i]->value); - } + tag_item_names[i.type], i.value); +} + +void tag_print(Client &client, const Tag &tag) +{ + if (!tag.duration.IsNegative()) + client_printf(client, SONG_TIME "%i\n", tag.duration.RoundS()); + + tag_print_values(client, tag); } |