[totem-pl-parser] plparse: Add image URLs from RSS feeds
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem-pl-parser] plparse: Add image URLs from RSS feeds
- Date: Sun, 26 Jan 2014 12:49:41 +0000 (UTC)
commit 4f7b519cc453811fa14e0b9b2af22d29b3523df9
Author: Bastien Nocera <hadess hadess net>
Date: Sun Jan 26 01:43:10 2014 +0100
plparse: Add image URLs from RSS feeds
Will give us thumbnails for:
http://www.theguardian.com/video/rss
plparse/totem-pl-parser-podcast.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plparse/totem-pl-parser-podcast.c b/plparse/totem-pl-parser-podcast.c
index 7c5afa1..7e1b57f 100644
--- a/plparse/totem-pl-parser-podcast.c
+++ b/plparse/totem-pl-parser-podcast.c
@@ -117,12 +117,12 @@ is_image (const char *url)
static TotemPlParserResult
parse_rss_item (TotemPlParser *parser, xml_node_t *parent)
{
- const char *title, *uri, *description, *author;
+ const char *title, *uri, *description, *author, *img;
const char *pub_date, *duration, *filesize, *content_type, *id;
xml_node_t *node;
title = uri = description = author = content_type = NULL;
- pub_date = duration = filesize = id = NULL;
+ img = pub_date = duration = filesize = id = NULL;
for (node = parent->child; node != NULL; node = node->next) {
if (node->name == NULL)
@@ -151,8 +151,11 @@ parse_rss_item (TotemPlParser *parser, xml_node_t *parent)
tmp = xml_parser_get_property (node, "type");
if (tmp != NULL &&
- g_str_has_prefix (tmp, "audio/") == FALSE)
+ g_str_has_prefix (tmp, "audio/") == FALSE) {
+ if (g_str_has_prefix (tmp, "image/"))
+ img = xml_parser_get_property (node, "url");
continue;
+ }
content_type = tmp;
tmp = xml_parser_get_property (node, "url");
@@ -201,6 +204,7 @@ parse_rss_item (TotemPlParser *parser, xml_node_t *parent)
TOTEM_PL_PARSER_FIELD_DURATION, duration,
TOTEM_PL_PARSER_FIELD_FILESIZE, filesize,
TOTEM_PL_PARSER_FIELD_CONTENT_TYPE, content_type,
+ TOTEM_PL_PARSER_FIELD_IMAGE_URI, img,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]