[banshee] [AmazonMp3] Add more debug logging



commit 75a10e9773b1c8b640958de23d83e4ba53618171
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Sep 29 13:07:15 2010 -0500

    [AmazonMp3] Add more debug logging
    
    Still trying to track down bgo#626195.  I also set the ImportManager to
    not use its own threading; might help.

 .../Banshee.IO/DirectoryScannerPipelineElement.cs  |    8 +++++++-
 .../Banshee.Collection/ImportManager.cs            |    6 ++++++
 .../Banshee.AmazonMp3/AmazonDownloadManager.cs     |    8 +++++++-
 3 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.IO/DirectoryScannerPipelineElement.cs b/src/Core/Banshee.Core/Banshee.IO/DirectoryScannerPipelineElement.cs
index 5125fbe..18ac959 100644
--- a/src/Core/Banshee.Core/Banshee.IO/DirectoryScannerPipelineElement.cs
+++ b/src/Core/Banshee.Core/Banshee.IO/DirectoryScannerPipelineElement.cs
@@ -37,6 +37,8 @@ namespace Banshee.IO
 {
     public class DirectoryScannerPipelineElement : QueuePipelineElement<string>
     {
+        public bool Debug { get; set; }
+
         public DirectoryScannerPipelineElement ()
         {
             SkipHiddenChildren = true;
@@ -45,6 +47,7 @@ namespace Banshee.IO
         protected override string ProcessItem (string item)
         {
             try {
+                if (Debug) Log.InformationFormat ("DirectoryScanner element processing {0}", item);
                 ScanForFiles (item, false);
             }
             finally {
@@ -68,7 +71,10 @@ namespace Banshee.IO
             try {
                 is_regular_file = Banshee.IO.File.Exists (source_uri);
                 is_directory = !is_regular_file && Banshee.IO.Directory.Exists (source);
-            } catch {
+                if (Debug) Log.InformationFormat ("  > item {0} is reg file? {1} is dir? {2}", source, is_regular_file, is_directory);
+            } catch (Exception e) {
+                if (Debug) Log.Exception ("Testing if path is file or dir", e);
+                if (Debug) Log.InformationFormat ("  > item {0} is reg file? {1} is dir? {2}", source, is_regular_file, is_directory);
                 return;
             }
 
diff --git a/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs b/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
index 4898342..a9263bd 100644
--- a/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
@@ -63,6 +63,7 @@ namespace Banshee.Collection
             protected override string ProcessItem (string item)
             {
                 try {
+                    if (manager.Debug) Log.InformationFormat ("ImportElement processing {0}", item);
                     manager.OnImportRequested (item);
                 } catch (Exception e) {
                     Hyena.Log.Exception (e);
@@ -73,6 +74,11 @@ namespace Banshee.Collection
 
 #endregion
 
+        public bool Debug {
+            get { return scanner_element.Debug; }
+            set { scanner_element.Debug = value; }
+        }
+
         private static NumberFormatInfo number_format = new NumberFormatInfo ();
 
         private DirectoryScannerPipelineElement scanner_element;
diff --git a/src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmazonDownloadManager.cs b/src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmazonDownloadManager.cs
index 8f1275e..71ea8b7 100644
--- a/src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmazonDownloadManager.cs
+++ b/src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmazonDownloadManager.cs
@@ -63,7 +63,9 @@ namespace Banshee.AmazonMp3
             ServiceManager.Get<JobScheduler> ().Add (job);
 
             import_manager = new LibraryImportManager (true) {
-                KeepUserJobHidden = true
+                KeepUserJobHidden = true,
+                Debug = true,
+                Threaded = false
             };
             import_manager.ImportResult += OnImportManagerImportResult;
 
@@ -183,7 +185,11 @@ namespace Banshee.AmazonMp3
                             import_event.Reset ();
                         }
                         Log.InformationFormat ("Finished downloading \"{0}\" by {1}; adding to import queue", track.Title, track.Creator);
+                        try {
                         import_manager.Enqueue (amz_downloader.LocalPath);
+                        } catch (Exception e) {
+                            Log.Exception ("Trying to queue amz file", e);
+                        }
                         break;
                     default:
                         non_mp3_queue.Enqueue (amz_downloader);



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