[totem-pl-parser] tests: Add itunes genre ( <itunes:category> ) support for podcast rss feeds
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem-pl-parser] tests: Add itunes genre ( <itunes:category> ) support for podcast rss feeds
- Date: Wed, 15 Sep 2021 12:21:43 +0000 (UTC)
commit 701935b57df2b89dbcbcc1d6021f4939c647f337
Author: crvi <crvisqr gmail com>
Date: Sun Apr 11 19:17:06 2021 +0530
tests: Add itunes genre ( <itunes:category> ) support for podcast rss feeds
plparse/tests/content-no-rating.rss | 10 ++++++++
plparse/tests/parser.c | 49 +++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+)
---
diff --git a/plparse/tests/content-no-rating.rss b/plparse/tests/content-no-rating.rss
index f068d6d..6e01826 100644
--- a/plparse/tests/content-no-rating.rss
+++ b/plparse/tests/content-no-rating.rss
@@ -5,6 +5,7 @@
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
+ xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
>
<channel>
@@ -27,6 +28,15 @@
<width>32</width>
<height>32</height>
</image>
+ <itunes:category text="Health & Fitness">
+ <itunes:category text="Alternative Health"/>
+ </itunes:category>
+ <itunes:category text="Education">
+ <itunes:category text="Self-Improvement"/>
+ </itunes:category>
+ <itunes:category text="Health & Fitness">
+ <itunes:category text="Nutrition"/>
+ </itunes:category>
<item>
<title>Escape Pod 769: Deal</title>
<link>https://escapepod.org/2021/01/28/escape-pod-769-deal/</link>
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c
index 35f62f2..1a3aa4d 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -1084,6 +1084,54 @@ test_parsing_xml_cdata (void)
g_free (uri);
}
+static void
+test_parsing_feed_genres (void)
+{
+ char *uri;
+
+ /* missing genre */
+ uri = get_relative_uri (TEST_SRCDIR "541405.rss");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRE), ==, NULL);
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRES), ==, NULL);
+ g_free (uri);
+
+ /* single genre 1 */
+ uri = get_relative_uri (TEST_SRCDIR "podcast-description.rss");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRE), ==, "Society &
Culture");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRES), ==, "Society &
Culture");
+ g_free (uri);
+
+ /* single genre 2 */
+ uri = get_relative_uri (TEST_SRCDIR "791154-kqed.rss");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRE), ==, "News &
Politics");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRES), ==, "News &
Politics");
+ g_free (uri);
+
+ /* single genre (with single subgenre) */
+ uri = get_relative_uri (TEST_SRCDIR "HackerMedley");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRE), ==,
"Technology/Tech News");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRES), ==,
"Technology/Tech News");
+ g_free (uri);
+
+ /* multiple genre 1 */
+ uri = get_relative_uri (TEST_SRCDIR "560051.xml");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRE), ==, "Society &
Culture");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRES), ==, "Society &
Culture,News & Politics,Religion & Spirituality");
+ g_free (uri);
+
+ /* multiple genre (with single subgenre) */
+ uri = get_relative_uri (TEST_SRCDIR "585407.rss");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRE), ==, "Business");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRES), ==,
"Business,Health/Self-Help");
+ g_free (uri);
+
+ /* multiple genre (with subgenres) */
+ uri = get_relative_uri (TEST_SRCDIR "content-no-rating.rss");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRE), ==, "Health &
Fitness/Alternative Health");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_GENRES), ==, "Health &
Fitness/Alternative Health,Education/Self-Improvement,Health & Fitness/Nutrition");
+ g_free (uri);
+}
+
static void
test_parsing_hadess (void)
{
@@ -1897,6 +1945,7 @@ main (int argc, char *argv[])
g_test_add_func ("/parser/parsing/podcast_item_explicit", test_parsing_item_explicit);
g_test_add_func ("/parser/parsing/invalid_characters", test_invalid_characters);
g_test_add_func ("/parser/parsing/invalid_utf8_characters", test_invalid_utf8_characters);
+ g_test_add_func ("/parser/parsing/podcast_feed_genres", test_parsing_feed_genres);
g_test_add_func ("/parser/parsing/live_streaming", test_parsing_live_streaming);
g_test_add_func ("/parser/parsing/xml_mixed_cdata", test_parsing_xml_mixed_cdata);
g_test_add_func ("/parser/parsing/m3u_streaming", test_parsing_m3u_streaming);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]