[banshee] [AppleDevice] Create the iPod datebase if missing



commit 3f458ab1e0558b3225a4a25531663edc69779cbb
Author: Alex Launi <alex launi gmail com>
Date:   Tue Aug 31 14:32:09 2010 -0400

    [AppleDevice] Create the iPod datebase if missing

 .../Banshee.Dap.AppleDevice/AppleDeviceSource.cs   |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs
index 3f88425..9558ff4 100644
--- a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs
+++ b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs
@@ -155,7 +155,16 @@ namespace Banshee.Dap.AppleDevice
                 if (MediaDatabase != null)
                     MediaDatabase.Dispose ();
 
-                MediaDatabase = new GPod.ITDB (Device.Mountpoint);
+                try {
+                    MediaDatabase = new GPod.ITDB (Device.Mountpoint);
+                } catch (GLib.GException) {
+                    Log.Information ("No iPod database could be loaded, creating a new one");
+                    GPod.ITDB.InitIpod (Volume.MountPoint, null, Volume.Name);
+                    // this may throw again. In the future we need to implement some kind of alert
+                    // mechanism to let the user know that something more serious is wrong with their
+                    // apple device a la the other iPod extension.
+                    MediaDatabase = new GPod.ITDB (Device.Mountpoint);
+                }
             }
 
             foreach (var ipod_track in MediaDatabase.Tracks) {



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