aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-03 12:33:14 +0100
committerMax Kellermann <max@duempel.org>2013-12-03 12:33:14 +0100
commitd99bdca0949b709bfbd20dcbf97aa5750117d12a (patch)
tree0157dbce94311c36ec5d554c71207be1d162af18 /src/playlist
parent187069bec91ffaab5ca17461c7e76f668de9c87b (diff)
downloadmpd-d99bdca0949b709bfbd20dcbf97aa5750117d12a.tar.gz
mpd-d99bdca0949b709bfbd20dcbf97aa5750117d12a.tar.xz
mpd-d99bdca0949b709bfbd20dcbf97aa5750117d12a.zip
playlist/xspf: use class TagBuilder
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/XspfPlaylistPlugin.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/playlist/XspfPlaylistPlugin.cxx b/src/playlist/XspfPlaylistPlugin.cxx
index ef37b847f..2935225e4 100644
--- a/src/playlist/XspfPlaylistPlugin.cxx
+++ b/src/playlist/XspfPlaylistPlugin.cxx
@@ -22,7 +22,7 @@
#include "PlaylistPlugin.hxx"
#include "MemorySongEnumerator.hxx"
#include "InputStream.hxx"
-#include "tag/Tag.hxx"
+#include "tag/TagBuilder.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
@@ -64,6 +64,8 @@ struct XspfParser {
*/
Song *song;
+ TagBuilder tag_builder;
+
XspfParser()
:state(ROOT) {}
};
@@ -147,8 +149,11 @@ xspf_end_element(gcc_unused GMarkupParseContext *context,
case XspfParser::TRACK:
if (strcmp(element_name, "track") == 0) {
- if (parser->song != nullptr)
+ if (parser->song != nullptr) {
+ assert(parser->song->tag == nullptr);
+ parser->song->tag = parser->tag_builder.Commit();
parser->songs.emplace_front(parser->song);
+ }
parser->state = XspfParser::TRACKLIST;
} else
@@ -177,11 +182,9 @@ xspf_text(gcc_unused GMarkupParseContext *context,
case XspfParser::TRACK:
if (parser->song != nullptr &&
- parser->tag_type != TAG_NUM_OF_ITEM_TYPES) {
- if (parser->song->tag == nullptr)
- parser->song->tag = new Tag();
- parser->song->tag->AddItem(parser->tag_type, text, text_len);
- }
+ parser->tag_type != TAG_NUM_OF_ITEM_TYPES)
+ parser->tag_builder.AddItem(parser->tag_type,
+ text, text_len);
break;