[banshee] ArtworkManager: add --fetch-artwork argument



commit 8c9ab81c72a5164b162438b05a843cc5baf30e49
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Fri Apr 15 19:54:49 2011 -0500

    ArtworkManager: add --fetch-artwork argument
    
    This resets the CoverArtDownloads database table and the last_scan gconf
    key so that all albums will be checked to ensure they have cover art -
    and if not, it will be fetched - ignoring the rate limiting we normally
    impose to prevent re-checking all the time.

 .../Banshee.Collection.Gui/ArtworkManager.cs       |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
index f8fe24b..6e1aa47 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
@@ -82,6 +82,10 @@ namespace Banshee.Collection.Gui
                 Log.Exception ("Could not migrate album artwork cache directory", e);
             }
 
+            if (ApplicationContext.CommandLine.Contains ("fetch-artwork")) {
+                ResetScanResultCache ();
+            }
+
             Banshee.Metadata.MetadataService.Instance.ArtworkUpdated += OnArtworkUpdated;
         }
 
@@ -425,11 +429,7 @@ namespace Banshee.Collection.Gui
                 }
 
                 if (count == 0) {
-                    try {
-                        ServiceManager.DbConnection.Execute ("DELETE FROM CoverArtDownloads");
-                        DatabaseConfigurationClient.Client.Set<DateTime> ("last_cover_art_scan", DateTime.MinValue);
-                        Log.InformationFormat ("Reset CoverArtDownloads table so missing artwork will get fetched");
-                    } catch {}
+                    ResetScanResultCache ();
                 }
 
                 Directory.Delete (legacy_root_path, true);
@@ -439,6 +439,15 @@ namespace Banshee.Collection.Gui
             CacheVersion = CUR_VERSION;
         }
 
+        private void ResetScanResultCache ()
+        {
+            try {
+                ServiceManager.DbConnection.Execute ("DELETE FROM CoverArtDownloads");
+                DatabaseConfigurationClient.Client.Set<DateTime> ("last_cover_art_scan", DateTime.MinValue);
+                Log.InformationFormat ("Reset CoverArtDownloads table so missing artwork will get fetched");
+            } catch {}
+        }
+
         private static SafeUri cache_version_file = new SafeUri (Paths.Combine (CoverArtSpec.RootPath, ".cache_version"));
         private static int CacheVersion {
             get {



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