summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2020-10-23 01:29:42 +0200
committerSam Thursfield <sam@afuera.me.uk>2020-10-23 01:37:01 +0200
commit2269ad97040f1c71c1f613a09054ad79be4ca20f (patch)
treebe1fb86591618b6167effae60104f969b57b9320
parentb58c60f8fd94ecf4a2896a6a26528520bda37435 (diff)
downloadtotem-pl-parser-sam/xspf-title.tar.gz
Correctly parse XSPF title fieldsam/xspf-title
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 64109ad..b9517a8 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -645,6 +645,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;
@@ -1446,6 +1455,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;
}