[banshee] [AppleDevice] Create Master playlist if needed
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [AppleDevice] Create Master playlist if needed
- Date: Fri, 24 Sep 2010 18:45:35 +0000 (UTC)
commit c363f88a8fdc6afea0b4911cb40795e1f16b23b7
Author: Gabriel Burt <gabriel burt gmail com>
Date: Fri Sep 24 11:23:13 2010 -0500
[AppleDevice] Create Master playlist if needed
Implement renaming too, by setting the name of the master playlist
.../Banshee.Dap.AppleDevice/AppleDeviceSource.cs | 54 ++++++++++----------
1 files changed, 27 insertions(+), 27 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 4f099bb..a9d8ed2 100644
--- a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs
+++ b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs
@@ -164,16 +164,26 @@ namespace Banshee.Dap.AppleDevice
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);
+ } catch (GLib.GException e) {
+ Log.Exception ("iPod database could be loaded, creating a new one", e);
+ if (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);
+ } else {
+ Log.Error ("Failed to init iPod database");
+ return;
+ }
}
}
+ if (MediaDatabase.MasterPlaylist == null) {
+ MediaDatabase.Playlists.Add (new GPod.Playlist (Name) {
+ IsMaster = true
+ });
+ }
+
if (SupportsPodcasts && MediaDatabase.PodcastsPlaylist == null) {
MediaDatabase.Playlists.Add (new GPod.Playlist (Catalog.GetString ("Podcasts")) {
IsPodcast = true
@@ -271,26 +281,16 @@ namespace Banshee.Dap.AppleDevice
public override void Rename (string name)
{
- return;
-// if (!CanRename) {
-// return;
-// }
-//
-// try {
-// if (name_path != null) {
-// Directory.CreateDirectory (Path.GetDirectoryName (name_path));
-//
-// using (StreamWriter writer = new StreamWriter (File.Open (name_path, FileMode.Create),
-// System.Text.Encoding.Unicode)) {
-// writer.Write (name);
-// }
-// }
-// } catch (Exception e) {
-// Log.Exception (e);
-// }
-//
-// ipod_device.Name = name;
-// base.Rename (name);
+ if (!CanRename) {
+ return;
+ }
+
+ try {
+ MediaDatabase.MasterPlaylist.Name = name;
+ base.Rename (name);
+ } catch (Exception e) {
+ Log.Exception ("Trying to change iPod name", e);
+ }
}
public override bool CanRename {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]