aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist/AsxPlaylistPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-03 12:14:33 +0100
committerMax Kellermann <max@duempel.org>2013-12-03 12:15:43 +0100
commit78c0d8cc886e1989650248f2727f50f249e3ef0e (patch)
tree71c39462c85a7e6ac9497f45c0d361b7b15c002e /src/playlist/AsxPlaylistPlugin.cxx
parentb23d2ad43b8cbf59b2fe87046a49094b1df30817 (diff)
downloadmpd-78c0d8cc886e1989650248f2727f50f249e3ef0e.tar.gz
mpd-78c0d8cc886e1989650248f2727f50f249e3ef0e.tar.xz
mpd-78c0d8cc886e1989650248f2727f50f249e3ef0e.zip
playlist/asx: use class TagBuilder
Diffstat (limited to '')
-rw-r--r--src/playlist/AsxPlaylistPlugin.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/playlist/AsxPlaylistPlugin.cxx b/src/playlist/AsxPlaylistPlugin.cxx
index 7f2eef2b5..47983358a 100644
--- a/src/playlist/AsxPlaylistPlugin.cxx
+++ b/src/playlist/AsxPlaylistPlugin.cxx
@@ -23,7 +23,7 @@
#include "MemorySongEnumerator.hxx"
#include "InputStream.hxx"
#include "Song.hxx"
-#include "tag/Tag.hxx"
+#include "tag/TagBuilder.hxx"
#include "util/ASCII.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
@@ -65,6 +65,8 @@ struct AsxParser {
*/
Song *song;
+ TagBuilder tag_builder;
+
AsxParser()
:state(ROOT) {}
@@ -106,18 +108,13 @@ asx_start_element(gcc_unused GMarkupParseContext *context,
attribute_values,
"href");
if (href != nullptr) {
- /* create new song object, and copy
- the existing tag over; we cannot
+ /* create new song object; we cannot
replace the existing song's URI,
because that attribute is
immutable */
Song *song = Song::NewRemote(href);
-
- if (parser->song != nullptr) {
- song->tag = parser->song->tag;
- parser->song->tag = nullptr;
+ if (parser->song != nullptr)
parser->song->Free();
- }
parser->song = song;
}
@@ -145,9 +142,11 @@ asx_end_element(gcc_unused GMarkupParseContext *context,
case AsxParser::ENTRY:
if (StringEqualsCaseASCII(element_name, "entry")) {
- if (strcmp(parser->song->uri, "asx:") != 0)
+ if (strcmp(parser->song->uri, "asx:") != 0) {
+ assert(parser->song->tag == nullptr);
+ parser->song->tag = parser->tag_builder.Commit();
parser->songs.emplace_front(parser->song);
- else
+ } else
parser->song->Free();
parser->state = AsxParser::ROOT;
@@ -171,10 +170,8 @@ asx_text(gcc_unused GMarkupParseContext *context,
case AsxParser::ENTRY:
if (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_builder.AddItem(parser->tag_type,
+ text, text_len);
}
break;