diff options
Diffstat (limited to 'plparse')
-rw-r--r-- | plparse/tests/parser.c | 10 | ||||
-rw-r--r-- | plparse/tests/playlist.xspf | 2 | ||||
-rw-r--r-- | plparse/totem-pl-parser-xspf.c | 52 |
3 files changed, 46 insertions, 18 deletions
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c index 2350a1c..48882f9 100644 --- a/plparse/tests/parser.c +++ b/plparse/tests/parser.c @@ -513,6 +513,15 @@ test_parsing_xspf_genre (void) } static void +test_parsing_xspf_escaping (void) +{ + char *uri; + uri = get_relative_uri (TEST_SRCDIR "playlist.xspf"); + g_assert_cmpstr (parser_test_get_entry_field (uri, TOTEM_PL_PARSER_FIELD_URI), ==, "http://207.200.96.226:8000 extraparam=1"); + g_free (uri); +} + +static void test_smi_starttime (void) { char *uri; @@ -1138,6 +1147,7 @@ main (int argc, char *argv[]) g_test_add_func ("/parser/parsing/not_really_php_but_html_instead", test_parsing_not_really_php_but_html_instead); 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/itms_link", test_itms_parsing); g_test_add_func ("/parser/parsing/lastfm-attributes", test_lastfm_parsing); g_test_add_func ("/parser/parsing/m3u_separator", test_m3u_separator); diff --git a/plparse/tests/playlist.xspf b/plparse/tests/playlist.xspf index 543780d..75cd302 100644 --- a/plparse/tests/playlist.xspf +++ b/plparse/tests/playlist.xspf @@ -3,7 +3,7 @@ <creator>audacious-plugins-1.4.5</creator> <trackList> <track> - <location>http://207.200.96.226:8000</location> + <location>http://207.200.96.226:8000 extraparam=1</location> <title>Sven Van Hess - Ocean Jive (Groove Salad: a nicely chilled plate of ambient beats and grooves. [SomaFM])</title> <meta rel="mtime">0</meta> <extension application="http://www.rhythmbox.org"> diff --git a/plparse/totem-pl-parser-xspf.c b/plparse/totem-pl-parser-xspf.c index 7fb264d..02c5217 100644 --- a/plparse/totem-pl-parser-xspf.c +++ b/plparse/totem-pl-parser-xspf.c @@ -306,23 +306,41 @@ parse_xspf_track (TotemPlParser *parser, GFile *base_file, xmlDocPtr doc, } resolved_uri = totem_pl_parser_resolve_uri (base_file, (char *) uri); - resolved = g_file_new_for_uri (resolved_uri); - g_free (resolved_uri); - - totem_pl_parser_add_uri (parser, - TOTEM_PL_PARSER_FIELD_FILE, resolved, - TOTEM_PL_PARSER_FIELD_TITLE, title, - TOTEM_PL_PARSER_FIELD_DURATION_MS, duration, - TOTEM_PL_PARSER_FIELD_IMAGE_URI, image_uri, - TOTEM_PL_PARSER_FIELD_AUTHOR, artist, - TOTEM_PL_PARSER_FIELD_ALBUM, album, - TOTEM_PL_PARSER_FIELD_MOREINFO, moreinfo, - TOTEM_PL_PARSER_FIELD_DOWNLOAD_URI, download_uri, - TOTEM_PL_PARSER_FIELD_ID, id, - TOTEM_PL_PARSER_FIELD_GENRE, genre, - TOTEM_PL_PARSER_FIELD_FILESIZE, filesize, - NULL); - g_object_unref (resolved); + + if (g_strcmp0 (resolved_uri, (char *) uri) == 0) { + g_free (resolved_uri); + totem_pl_parser_add_uri (parser, + TOTEM_PL_PARSER_FIELD_URI, uri, + TOTEM_PL_PARSER_FIELD_TITLE, title, + TOTEM_PL_PARSER_FIELD_DURATION_MS, duration, + TOTEM_PL_PARSER_FIELD_IMAGE_URI, image_uri, + TOTEM_PL_PARSER_FIELD_AUTHOR, artist, + TOTEM_PL_PARSER_FIELD_ALBUM, album, + TOTEM_PL_PARSER_FIELD_MOREINFO, moreinfo, + TOTEM_PL_PARSER_FIELD_DOWNLOAD_URI, download_uri, + TOTEM_PL_PARSER_FIELD_ID, id, + TOTEM_PL_PARSER_FIELD_GENRE, genre, + TOTEM_PL_PARSER_FIELD_FILESIZE, filesize, + NULL); + } else { + resolved = g_file_new_for_uri (resolved_uri); + g_free (resolved_uri); + + totem_pl_parser_add_uri (parser, + TOTEM_PL_PARSER_FIELD_FILE, resolved, + TOTEM_PL_PARSER_FIELD_TITLE, title, + TOTEM_PL_PARSER_FIELD_DURATION_MS, duration, + TOTEM_PL_PARSER_FIELD_IMAGE_URI, image_uri, + TOTEM_PL_PARSER_FIELD_AUTHOR, artist, + TOTEM_PL_PARSER_FIELD_ALBUM, album, + TOTEM_PL_PARSER_FIELD_MOREINFO, moreinfo, + TOTEM_PL_PARSER_FIELD_DOWNLOAD_URI, download_uri, + TOTEM_PL_PARSER_FIELD_ID, id, + TOTEM_PL_PARSER_FIELD_GENRE, genre, + TOTEM_PL_PARSER_FIELD_FILESIZE, filesize, + NULL); + g_object_unref (resolved); + } retval = TOTEM_PL_PARSER_RESULT_SUCCESS; |