banshee r4116 - in trunk/banshee: . src/Extensions/Banshee.Podcasting/Banshee.Podcasting src/Libraries/Migo/Migo.Syndication



Author: gburt
Date: Wed Jun  4 21:55:13 2008
New Revision: 4116
URL: http://svn.gnome.org/viewvc/banshee?rev=4116&view=rev

Log:
2008-06-04  Gabriel Burt  <gabriel burt gmail com>

	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs:
	* src/Libraries/Migo/Migo.Syndication/RssParser.cs: Fix bug with earlier
	fix for <item> guids that would cause some duplicates under some
	circumstances.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs
   trunk/banshee/src/Libraries/Migo/Migo.Syndication/RssParser.cs

Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs	Wed Jun  4 21:55:13 2008
@@ -172,15 +172,20 @@
                 DatabaseConfigurationClient.Client.Set<int> ("Podcast", "Version", 1);
             }
 
-            if (DatabaseConfigurationClient.Client.Get<int> ("Podcast", "Version", 0) == 1) {
+            if (DatabaseConfigurationClient.Client.Get<int> ("Podcast", "Version", 0) < 3) {
                 // We were using the Link as the fallback if the actual Guid was missing, but that was a poor choice
                 // since it is not always unique.  We now use the title and pubdate combined.
+                ServiceManager.DbConnection.Execute ("UPDATE PodcastItems SET Guid = NULL");
                 foreach (FeedItem item in FeedItem.Provider.FetchAll ()) {
                     item.Guid = null;
-                    item.Save ();
+                    if (FeedItem.Exists (item.Feed.DbId, item.Guid)) {
+                        item.Delete (false);
+                    } else {
+                        item.Save ();
+                    }
                 }
 
-                DatabaseConfigurationClient.Client.Set<int> ("Podcast", "Version", 2);
+                DatabaseConfigurationClient.Client.Set<int> ("Podcast", "Version", 3);
             }
         }
         

Modified: trunk/banshee/src/Libraries/Migo/Migo.Syndication/RssParser.cs
==============================================================================
--- trunk/banshee/src/Libraries/Migo/Migo.Syndication/RssParser.cs	(original)
+++ trunk/banshee/src/Libraries/Migo/Migo.Syndication/RssParser.cs	Wed Jun  4 21:55:13 2008
@@ -152,7 +152,9 @@
                 
                 item.Author            = GetXmlNodeText (node, "author");
                 item.Comments          = GetXmlNodeText (node, "comments");
-                item.Guid              = GetXmlNodeText (node, "guid");
+                // Removed, since we form our own Guid, since feeds don't seem to be consistent
+                // about including this element.
+                //item.Guid              = GetXmlNodeText (node, "guid");
                 item.Link              = GetXmlNodeText (node, "link");
                 item.PubDate           = GetRfc822DateTime (node, "pubDate");
                 item.Modified          = GetRfc822DateTime (node, "dcterms:modified");



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