[banshee] [RssParser] Accept feeds with empty title



commit b6f319c3e0b80a8da93672df1f613ab5e67e0be3
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Fri Mar 5 20:53:05 2010 +0100

    [RssParser] Accept feeds with empty title
    
    Check for the existence of a title tag in RSS feeds, but accept feeds
    in which it's empty. Make sure it's displayed as "Unknown Podcast" in
    that case. Fixes bgo#600685.

 src/Libraries/Migo/Migo.Syndication/RssParser.cs |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/Libraries/Migo/Migo.Syndication/RssParser.cs b/src/Libraries/Migo/Migo.Syndication/RssParser.cs
index 1877d73..1763460 100644
--- a/src/Libraries/Migo/Migo.Syndication/RssParser.cs
+++ b/src/Libraries/Migo/Migo.Syndication/RssParser.cs
@@ -93,6 +93,9 @@ namespace Migo.Syndication
             try {
                 if (feed.Title == null || feed.Title.Trim () == "" || feed.Title == Mono.Unix.Catalog.GetString ("Unknown Podcast")) {
                     feed.Title = StringUtil.RemoveNewlines (GetXmlNodeText (doc, "/rss/channel/title"));
+                    if (String.IsNullOrEmpty (feed.Title)) {
+                        feed.Title = Mono.Unix.Catalog.GetString ("Unknown Podcast");
+                    }
                 }
 
                 feed.Description      = StringUtil.RemoveNewlines (GetXmlNodeText (doc, "/rss/channel/description"));
@@ -251,10 +254,8 @@ namespace Migo.Syndication
                 throw new FormatException ("Invalid RSS document.");
             }
 
-            if (GetXmlNodeText (doc, "/rss/channel/title") == String.Empty) {
-                throw new FormatException (
-                    "node: 'title', 'description', and 'link' nodes must exist."
-                );
+            if (doc.SelectSingleNode ("/rss/channel/title") == null) {
+                throw new FormatException ("Invalid RSS document. Node 'title' is required");
             }
 
             mgr = new XmlNamespaceManager (doc.NameTable);



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