banshee r3954 - in trunk/banshee: . src/Extensions/Banshee.Podcasting/Banshee.Podcasting src/Libraries/Hyena/Hyena.Data.Sqlite src/Libraries/Migo/Migo/Migo.Syndication



Author: gburt
Date: Thu May 22 06:26:36 2008
New Revision: 3954
URL: http://svn.gnome.org/viewvc/banshee?rev=3954&view=rev

Log:
2008-05-21  Scott Peterson  <lunchtimemama gmail com>

	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs:
	* src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs:
	* src/Libraries/Migo/Migo/Migo.Syndication/FeedManager.cs:
	* src/Libraries/Migo/Migo/Migo.Syndication/Feed.cs:
	Add IsSubscribed to Feed and modified migration code to use true as the
	default.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs
   trunk/banshee/src/Libraries/Migo/Migo/Migo.Syndication/Feed.cs
   trunk/banshee/src/Libraries/Migo/Migo/Migo.Syndication/FeedManager.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	Thu May 22 06:26:36 2008
@@ -98,7 +98,7 @@
                     Hyena.Log.Information ("Migrating Podcast Feeds and Items");
                     ServiceManager.DbConnection.Execute(@"
                         INSERT INTO PodcastSyndications (FeedID, Title, Url, Link,
-                            Description, ImageUrl, LastBuildDate, SyncSetting)
+                            Description, ImageUrl, LastBuildDate, SyncSetting, IsSubscribed)
                             SELECT 
                                 PodcastFeedID,
                                 Title,
@@ -107,7 +107,8 @@
                                 Description,
                                 Image,
                                 strftime(""%s"", LastUpdated),
-                                SyncPreference
+                                SyncPreference,
+                                1
                             FROM PodcastFeeds
                     ");
 

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs	Thu May 22 06:26:36 2008
@@ -185,7 +185,7 @@
                 HyenaTableName, name, version));
         }
         
-        private void CheckTable ()
+        protected void CheckTable ()
         {
             //Console.WriteLine ("In {0} checking for table {1}", this, TableName);
             IDictionary<string, string> schema = connection.GetSchema (TableName);

Modified: trunk/banshee/src/Libraries/Migo/Migo/Migo.Syndication/Feed.cs
==============================================================================
--- trunk/banshee/src/Libraries/Migo/Migo/Migo.Syndication/Feed.cs	(original)
+++ trunk/banshee/src/Libraries/Migo/Migo/Migo.Syndication/Feed.cs	Thu May 22 06:26:36 2008
@@ -62,16 +62,36 @@
         ItemsQueued = 5,        
         None = 6        
     }
+    
+    public class FeedProvider : MigoModelProvider<Feed>
+    {
+        public FeedProvider (HyenaSqliteConnection connection) : base (connection, "PodcastSyndications")
+        {
+        }
+        
+        protected override int ModelVersion {
+            get { return 2; }
+        }
+
+        protected override void MigrateTable (int old_version)
+        {
+            Log.Debug("WE DID IT!");
+            if (old_version < 2) {
+                CheckTable ();
+                Connection.Execute (String.Format ("UPDATE {0} SET IsSubscribed=1", TableName));
+            } else  Log.Debug ("Um... no we didn't");
+        }
+    }
 
     public class Feed : MigoItem<Feed>
     {
-        private static SqliteModelProvider<Feed> provider;
-        public static SqliteModelProvider<Feed> Provider {
+        private static FeedProvider provider;
+        public static FeedProvider Provider {
             get { return provider; }
         }
         
         public static void Init () {
-            provider = new MigoModelProvider<Feed> (FeedsManager.Instance.Connection, "PodcastSyndications");
+            provider = new FeedProvider (FeedsManager.Instance.Connection);
         }
 
         public static bool Exists (string url)
@@ -249,6 +269,13 @@
             set { download_status = value; Manager.OnFeedsChanged (); }
         }
         
+        [DatabaseColumn("IsSubscribed")]
+        private bool is_subscribed;
+        public bool IsSubscribed {
+            get { return is_subscribed; }
+            set { is_subscribed = value; }
+        }
+        
 #endregion
 
 #region Other Properties  

Modified: trunk/banshee/src/Libraries/Migo/Migo/Migo.Syndication/FeedManager.cs
==============================================================================
--- trunk/banshee/src/Libraries/Migo/Migo/Migo.Syndication/FeedManager.cs	(original)
+++ trunk/banshee/src/Libraries/Migo/Migo/Migo.Syndication/FeedManager.cs	Thu May 22 06:26:36 2008
@@ -76,14 +76,20 @@
         {
             return update_feed_map.ContainsKey (feed);
         }
-
+        
         public Feed CreateFeed (string url, FeedAutoDownload autoDownload)
         {
+            return CreateFeed (url, autoDownload, true);
+        }
+
+        public Feed CreateFeed (string url, FeedAutoDownload autoDownload, bool is_subscribed)
+        {
             Feed feed = null;
             url = url.Trim ().TrimEnd ('/');
 
             if (!Feed.Exists (url)) {
                 feed = new Feed (url, autoDownload);
+                feed.IsSubscribed = is_subscribed;
                 feed.Save ();
                 feed.Update ();
             }



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