[banshee/gio-hardware] [Dap.Ipod] Save URIs when syncing to fix inconsistency (BGO#620826)
- From: Alex Launi <alexlauni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/gio-hardware] [Dap.Ipod] Save URIs when syncing to fix inconsistency (BGO#620826)
- Date: Thu, 5 Aug 2010 09:32:20 +0000 (UTC)
commit 86b83e1a398496f5a08d81a2b3263b83f019d1a4
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Thu Jul 22 19:33:50 2010 +0200
[Dap.Ipod] Save URIs when syncing to fix inconsistency (BGO#620826)
This patch does basically two things:
- Change the call to CreateTrack() by a call to CreateTrack(uri),
because for the former parameterless method it's not clear that the
assignment of the Uri property does the real copy-file operation and
that its value changes after this happens. With CreateTrack(uri), the
copy-file operation happens and the Uri property gets the location of
where the file was copied to.
- After the creation of the track, we save the Uri to banshee db (this
happens only when the track was not already on the iPod).
.../Banshee.Dap.Ipod/IpodTrackInfo.cs | 23 ++++++++++++++-----
1 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs b/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs
index e35521a..f7a3d33 100644
--- a/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs
+++ b/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs
@@ -189,14 +189,25 @@ namespace Banshee.Dap.Ipod
public void CommitToIpod (IPod.Device device)
{
- track = track ?? device.TrackDatabase.CreateTrack ();
+ bool update = (track != null);
+ if (!update) {
+ try {
+ track = device.TrackDatabase.CreateTrack (Uri.AbsolutePath);
+ } catch (Exception e) {
+ Log.Exception ("Failed to create iPod track with Uri " + Uri.AbsoluteUri, e);
+ device.TrackDatabase.RemoveTrack (track);
+ return;
+ }
+ }
+
ExternalId = track.Id;
- try {
- track.Uri = new Uri (Uri.AbsoluteUri);
- } catch (Exception e) {
- Log.Exception ("Failed to create System.Uri for iPod track", e);
- device.TrackDatabase.RemoveTrack (track);
+ //if the track was not in the ipod already, the CreateTrack(uri)
+ //method updates the Uri property with the path of the new file
+ //so we need to save it on Banshee db to be properly synced
+ if (!update) {
+ Uri = new SafeUri (track.Uri);
+ Save ();
}
track.AlbumArtist = AlbumArtist;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]