banshee r4108 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.Podcasting/Banshee.Podcasting src/Libraries/Migo/Migo.Syndication



Author: gburt
Date: Wed Jun  4 17:58:22 2008
New Revision: 4108
URL: http://svn.gnome.org/viewvc/banshee?rev=4108&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/FeedItem.cs:
	* src/Libraries/Migo/Migo.Syndication/Feed.cs: Fix bug with the guid we
	use for identifying podcast items.  Some feeds don't give a guid for
	items, so we were using the <link>, but that isn't unique.  Instead, fall
	back to using a combination of the title and pubdate.  Fixes BGO #536555.

	* src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs:
	* src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml:
	Comment out the eq actions.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs
   trunk/banshee/src/Libraries/Migo/Migo.Syndication/Feed.cs
   trunk/banshee/src/Libraries/Migo/Migo.Syndication/FeedItem.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs	Wed Jun  4 17:58:22 2008
@@ -59,11 +59,11 @@
         {
             Add (new ActionEntry [] {
                 new ActionEntry ("ViewMenuAction", null,
-                    Catalog.GetString ("_View"), null, null, null),
+                    Catalog.GetString ("_View"), null, null, null)/*,
                     
                 new ActionEntry ("ShowEqualizerAction", null,
                    Catalog.GetString ("_Equalizer"), "<control>E",
-                   Catalog.GetString ("View the graphical equalizer"), OnShowEqualizer)
+                   Catalog.GetString ("View the graphical equalizer"), OnShowEqualizer)*/
             });
 
             AddImportant (new ToggleActionEntry [] {
@@ -86,11 +86,11 @@
         {
             if (((PlayerEventStateChangeArgs)args).Current == PlayerState.Ready && 
                 !ServiceManager.PlayerEngine.SupportsEqualizer) {
-                Actions["View.ShowEqualizerAction"].Sensitive = false;
+                //Actions["View.ShowEqualizerAction"].Sensitive = false;
             }
         }
                 
-        private void OnShowEqualizer (object o, EventArgs args)
+        /*private void OnShowEqualizer (object o, EventArgs args)
         {
             if (EqualizerWindow.Instance == null) {
                 EqualizerWindow eqwin = new EqualizerWindow (ServiceManager.Get<GtkElementsService> ().PrimaryWindow);
@@ -98,7 +98,7 @@
             } else {
                 EqualizerWindow.Instance.Present ();
             }
-        }
+        }*/
 
         private void OnFullScreen (object o, EventArgs args)
         {

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml	Wed Jun  4 17:58:22 2008
@@ -58,7 +58,7 @@
       <placeholder name="ViewMenuAdditions"/>
       <menuitem name="FullScreen" action="FullScreenAction"/>
       <separator/>
-      <menuitem name="ShowEqualizer" action="ShowEqualizerAction"/>
+      <!--<menuitem name="ShowEqualizer" action="ShowEqualizerAction"/>-->
     </menu>
 
     <menu name="PlaybackMenu" action="PlaybackMenuAction">

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 17:58:22 2008
@@ -172,6 +172,16 @@
                 DatabaseConfigurationClient.Client.Set<int> ("Podcast", "Version", 1);
             }
 
+            if (DatabaseConfigurationClient.Client.Get<int> ("Podcast", "Version", 0) == 1) {
+                // 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.
+                foreach (FeedItem item in FeedItem.Provider.FetchAll ()) {
+                    item.Guid = null;
+                    item.Save ();
+                }
+
+                DatabaseConfigurationClient.Client.Set<int> ("Podcast", "Version", 2);
+            }
         }
         
         public void Initialize ()

Modified: trunk/banshee/src/Libraries/Migo/Migo.Syndication/Feed.cs
==============================================================================
--- trunk/banshee/src/Libraries/Migo/Migo.Syndication/Feed.cs	(original)
+++ trunk/banshee/src/Libraries/Migo/Migo.Syndication/Feed.cs	Wed Jun  4 17:58:22 2008
@@ -401,7 +401,7 @@
         private bool AddItem (FeedItem item)
         {
             try {
-            if (!FeedItem.Exists (item.Guid)) {
+            if (!FeedItem.Exists (this.DbId, item.Guid)) {
                 item.Feed = this;
                 item.Save ();
                 return true;

Modified: trunk/banshee/src/Libraries/Migo/Migo.Syndication/FeedItem.cs
==============================================================================
--- trunk/banshee/src/Libraries/Migo/Migo.Syndication/FeedItem.cs	(original)
+++ trunk/banshee/src/Libraries/Migo/Migo.Syndication/FeedItem.cs	Wed Jun  4 17:58:22 2008
@@ -50,9 +50,12 @@
             get { return provider; }
         }
         
-        public static bool Exists (string guid)
+        public static bool Exists (long feed_id, string guid)
         {
-            return Provider.Connection.Query<int> (String.Format ("select count(*) from {0} where Guid = ?", Provider.TableName), guid) != 0;
+            return Provider.Connection.Query<int> (
+                String.Format ("SELECT count(*) FROM {0} WHERE FeedID = ? AND Guid = ?", Provider.TableName),
+                feed_id, guid
+            ) != 0;
         }
         
         public static void Init () {
@@ -121,7 +124,14 @@
         
         [DatabaseColumn("Guid", Index = "PodcastItemsGuidIndex")]
         public string Guid {
-            get { return String.IsNullOrEmpty (guid) ? Link : guid; }
+            get {
+                if (String.IsNullOrEmpty (guid)) {
+                    guid = String.Format ("{0}-{1}", Title,
+                        PubDate.ToUniversalTime ().ToString (System.Globalization.DateTimeFormatInfo.InvariantInfo)
+                    );
+                }
+                return guid;
+            }
             set { guid = value; }
         }
 



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