[totem-pl-parser] Export content-type for Podcasts
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem-pl-parser] Export content-type for Podcasts
- Date: Mon, 21 Mar 2011 14:54:42 +0000 (UTC)
commit d1f6e011cc574161a9b6278021ad32ffdc786adc
Author: Bastien Nocera <hadess hadess net>
Date: Mon Mar 21 14:50:33 2011 +0000
Export content-type for Podcasts
Using the newly added property
plparse/tests/parser.c | 10 ++++++++++
plparse/totem-pl-parser-podcast.c | 6 ++++--
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c
index 05b4996..e636931 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -560,6 +560,15 @@ test_parsing_rtsp_text (void)
}
static void
+test_parsing_content_type (void)
+{
+ char *uri;
+ uri = get_relative_uri (TEST_SRCDIR "HackerMedley");
+ g_assert_cmpstr (parser_test_get_entry_field (uri, TOTEM_PL_PARSER_FIELD_CONTENT_TYPE), ==, "audio/mpeg");
+ g_free (uri);
+}
+
+static void
test_parsing_hadess (void)
{
if (g_strcmp0 (g_get_user_name (), "hadess") == 0)
@@ -961,6 +970,7 @@ main (int argc, char *argv[])
g_test_add_func ("/parser/parsing/xml_comment_whitespace", test_parsing_xml_comment_whitespace);
g_test_add_func ("/parser/parsing/multi_line_rtsptext", test_parsing_rtsp_text_multi);
g_test_add_func ("/parser/parsing/single_line_rtsptext", test_parsing_rtsp_text);
+ g_test_add_func ("/parser/parsing/podcast_content_type", test_parsing_content_type);
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/not_asx_playlist", test_parsing_not_asx_playlist);
diff --git a/plparse/totem-pl-parser-podcast.c b/plparse/totem-pl-parser-podcast.c
index e329d91..5fc11d8 100644
--- a/plparse/totem-pl-parser-podcast.c
+++ b/plparse/totem-pl-parser-podcast.c
@@ -103,10 +103,10 @@ static TotemPlParserResult
parse_rss_item (TotemPlParser *parser, xml_node_t *parent)
{
const char *title, *uri, *description, *author;
- const char *pub_date, *duration, *filesize;
+ const char *pub_date, *duration, *filesize, *content_type;
xml_node_t *node;
- title = uri = description = author = NULL;
+ title = uri = description = author = content_type = NULL;
pub_date = duration = filesize = NULL;
for (node = parent->child; node != NULL; node = node->next) {
@@ -136,6 +136,7 @@ parse_rss_item (TotemPlParser *parser, xml_node_t *parent)
if (tmp != NULL &&
g_str_has_prefix (tmp, "audio/") == FALSE)
continue;
+ content_type = tmp;
tmp = xml_parser_get_property (node, "url");
if (tmp != NULL)
@@ -173,6 +174,7 @@ parse_rss_item (TotemPlParser *parser, xml_node_t *parent)
TOTEM_PL_PARSER_FIELD_AUTHOR, author,
TOTEM_PL_PARSER_FIELD_DURATION, duration,
TOTEM_PL_PARSER_FIELD_FILESIZE, filesize,
+ TOTEM_PL_PARSER_FIELD_CONTENT_TYPE, content_type,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]