summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2020-10-23 01:29:42 +0200
committerSam Thursfield <sam.thursfield@codethink.co.uk>2021-01-28 18:12:38 +0100
commit2788e93e25121e1dbf51f06a68d049f8f5244a15 (patch)
tree2db67c79170ec307491c41c186fefe1e99775241
parent91adcb2dcd9c590d9fab46e32fb6c4b50e1af2c1 (diff)
downloadtotem-pl-parser-2788e93e25121e1dbf51f06a68d049f8f5244a15.tar.gz
xspf: Correctly parse XSPF title field
Previously all XSPF playlists had the name "title".
-rw-r--r--plparse/tests/parser.c10
-rw-r--r--plparse/tests/playlist.xspf1
-rw-r--r--plparse/totem-pl-parser-xspf.c4
3 files changed, 14 insertions, 1 deletions
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c
index c85085d..e363b2d 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -651,6 +651,15 @@ test_parsing_xspf_escaping (void)
}
static void
+test_parsing_xspf_metadata (void)
+{
+ char *uri;
+ uri = get_relative_uri (TEST_SRCDIR "playlist.xspf");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_TITLE), ==, "Test Playlist");
+ g_free (uri);
+}
+
+static void
test_parsing_xspf_xml_base (void)
{
char *uri;
@@ -1452,6 +1461,7 @@ main (int argc, char *argv[])
g_test_add_func ("/parser/parsing/num_items_in_pls", test_parsing_num_entries);
g_test_add_func ("/parser/parsing/xspf_genre", test_parsing_xspf_genre);
g_test_add_func ("/parser/parsing/xspf_escaping", test_parsing_xspf_escaping);
+ g_test_add_func ("/parser/parsing/xspf_metadata", test_parsing_xspf_metadata);
g_test_add_func ("/parser/parsing/xspf_xml_base", test_parsing_xspf_xml_base);
g_test_add_func ("/parser/parsing/test_pl_content_type", test_pl_content_type);
g_test_add_func ("/parser/parsing/itms_link", test_itms_parsing);
diff --git a/plparse/tests/playlist.xspf b/plparse/tests/playlist.xspf
index 413e70c..57c08a0 100644
--- a/plparse/tests/playlist.xspf
+++ b/plparse/tests/playlist.xspf
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<creator>audacious-plugins-1.4.5</creator>
+ <title>Test Playlist</title>
<trackList>
<track>
<location>http://207.200.96.226:8000 extraparam=1</location>
diff --git a/plparse/totem-pl-parser-xspf.c b/plparse/totem-pl-parser-xspf.c
index f30883b..1a50316 100644
--- a/plparse/totem-pl-parser-xspf.c
+++ b/plparse/totem-pl-parser-xspf.c
@@ -473,7 +473,7 @@ parse_xspf_entries (TotemPlParser *parser,
continue;
if (g_ascii_strcasecmp ((char *)node->name, "title") == 0) {
- title = node->name;
+ title = xmlNodeListGetString (doc, node->xmlChildrenNode, 1);
break;
}
}
@@ -500,6 +500,8 @@ parse_xspf_entries (TotemPlParser *parser,
g_free (uri);
}
+ SAFE_FREE (title);
+
return retval;
}