[totem-pl-parser/wip/hadess/dont-recurse-videosite: 1/2] podcast: Do not check for videosite links unless requested




commit f5766492bbb1472293e166b85d23f14a4fa2a7b2
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 4 16:45:29 2021 +0100

    podcast: Do not check for videosite links unless requested
    
    We don't need to check whether links in RSS feeds are videosite links
    unless the application requested that we do, by enabling recursive
    parsing.
    
    Closes: #25

 plparse/totem-pl-parser-podcast.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plparse/totem-pl-parser-podcast.c b/plparse/totem-pl-parser-podcast.c
index 87917d8..16a31d6 100644
--- a/plparse/totem-pl-parser-podcast.c
+++ b/plparse/totem-pl-parser-podcast.c
@@ -273,6 +273,7 @@ parse_rss_item (TotemPlParser *parser, xml_node_t *parent)
                        if (tmp != NULL)
                                content_type = tmp;
                } else if (g_ascii_strcasecmp (node->name, "link") == 0 &&
+                          totem_pl_parser_get_recurse (parser) &&
                           totem_pl_parser_is_videosite (node->data, totem_pl_parser_is_debugging_enabled 
(parser)) != FALSE) {
                        uri = node->data;
                } else if (g_ascii_strcasecmp (node->name, "image") == 0) {
@@ -294,6 +295,7 @@ parse_rss_item (TotemPlParser *parser, xml_node_t *parent)
 
        if (id != NULL &&
            uri == NULL &&
+           totem_pl_parser_get_recurse (parser) &&
            totem_pl_parser_is_videosite (id, totem_pl_parser_is_debugging_enabled (parser)) != FALSE)
                uri = id;
 
@@ -580,8 +582,10 @@ parse_atom_entry (TotemPlParser *parser, xml_node_t *parent)
                                href = xml_parser_get_property (node, "href");
                                if (href == NULL)
                                        continue;
-                               if (!totem_pl_parser_is_videosite (href, totem_pl_parser_is_debugging_enabled 
(parser)))
+                               if (totem_pl_parser_get_recurse (parser) &&
+                                   !totem_pl_parser_is_videosite (href, totem_pl_parser_is_debugging_enabled 
(parser))) {
                                        continue;
+                               }
                                uri = href;
                        }
                } else if (g_ascii_strcasecmp (node->name, "updated") == 0
@@ -614,8 +618,10 @@ parse_atom_entry (TotemPlParser *parser, xml_node_t *parent)
                                        prop = xml_parser_get_property (child, "url");
                                        if (prop == NULL)
                                                continue;
-                                       if (!totem_pl_parser_is_videosite (prop, 
totem_pl_parser_is_debugging_enabled (parser)))
+                                       if (totem_pl_parser_get_recurse (parser) &&
+                                           !totem_pl_parser_is_videosite (prop, 
totem_pl_parser_is_debugging_enabled (parser))) {
                                                continue;
+                                       }
                                        uri = prop;
                                } else if (g_ascii_strcasecmp (child->name, "media:thumbnail") == 0) {
                                        img = xml_parser_get_property (child, "url");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]