banshee r5055 - in trunk/banshee: . src/Extensions/Banshee.Podcasting/Banshee.Podcasting



Author: gburt
Date: Fri Feb 20 22:14:08 2009
New Revision: 5055
URL: http://svn.gnome.org/viewvc/banshee?rev=5055&view=rev

Log:
2009-02-20  Gabriel Burt  <gabriel burt gmail com>

	Patch from John Millikin removing some cruft and changing the podcast
	cache location.

	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs:
	Store partially downloaded episodes in
	~/.cache/banshee-1/extensions/podcasting/partial-downloads/ instead of
	under ~/.config (BGO #569436).  Migration path included.

	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService_Interface.cs:
	Fix header.

	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastCore.cs:
	Remove unused file.

Removed:
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastCore.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService_Interface.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	Fri Feb 20 22:14:08 2009
@@ -75,7 +75,7 @@
             // TODO translate Podcasts folder?
             // If changed, change HACK in src/Core/Banshee.Services/Banshee.Collection/RescanPipeline.cs too
             tmp_enclosure_path = Path.Combine (Paths.LibraryLocation, "Podcasts");
-            tmp_download_path = Path.Combine (Paths.ApplicationData, "downloads");
+            tmp_download_path = Paths.Combine (Paths.ExtensionCacheRoot, "podcasting", "partial-downloads");
             Migo.Net.AsyncWebClient.DefaultUserAgent = Banshee.Web.Browser.UserAgent;
             
             download_manager = new DownloadManager (2, tmp_download_path);
@@ -203,7 +203,20 @@
                 DatabaseConfigurationClient.Client.Set<int> ("Podcast", "Version", 6);
             }
         }
-
+        
+        private void MigrateDownloadCache ()
+        {
+            string old_download_dir = Path.Combine (Paths.ApplicationData, "downloads");
+            if (Directory.Exists (old_download_dir)) {
+                foreach (string old_subdir in Directory.GetDirectories (old_download_dir)) {
+                    string subdir_name = Path.GetFileName (old_subdir);
+                    string new_subdir = Path.Combine (tmp_download_path, subdir_name);
+                    Directory.Move (old_subdir, new_subdir);
+                }
+                Directory.Delete (old_download_dir);
+            }
+        }
+        
         private void ReplaceNewlines (string table, string column)
         {
             string cmd = String.Format ("UPDATE {0} SET {1}=replace({1}, ?, ?)", table, column);
@@ -221,6 +234,13 @@
             // Migrate data from 0.13.2 podcast tables, if they exist
             MigrateLegacyIfNeeded ();
 
+            // Move incomplete downloads to the new cache location
+            try {
+                MigrateDownloadCache ();
+            } catch (Exception e) {
+                Hyena.Log.Exception ("Couldn't migrate podcast download cache", e);
+            }
+            
             feeds_manager.FeedManager.ItemAdded += OnItemAdded;
             feeds_manager.FeedManager.ItemChanged += OnItemChanged;
             feeds_manager.FeedManager.ItemRemoved += OnItemRemoved;

Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService_Interface.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService_Interface.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService_Interface.cs	Fri Feb 20 22:14:08 2009
@@ -1,5 +1,5 @@
 /*************************************************************************** 
- *  PodcastCoreInterface.cs
+ *  PodcastService_Interface.cs
  *
  *  Copyright (C) 2008 Michael C. Urbanski
  *  Written by Mike Urbanski <michael c urbanski gmail com>



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