I have an ipod with a linux partition and an ipod-os partition, and so it
gets mounted as /media/disk and /media/disk-2. Trouble is, they're randomly
allocated to the linux or the ipod-os partition.
I wrote this little patch so I can specify both directories on ipod_mount
configuration, separated by semicolons.
--
Paul Holt
From 32461eb98fd9b53714b8ba83581db0e719a211ac Mon Sep 17 00:00:00 2001
From: Paul Holt <p...@bob.(none)>
Date: Mon, 17 Aug 2009 22:41:33 +1000
Subject: [PATCH] Handle ipods with more than one partition
---
src/gpodder/sync.py | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/src/gpodder/sync.py b/src/gpodder/sync.py
index 99e9307..05a71c9 100644
--- a/src/gpodder/sync.py
+++ b/src/gpodder/sync.py
@@ -266,11 +266,14 @@ class iPodDevice(Device):
def __init__(self, config):
Device.__init__(self, config)
- self.mountpoint = str(self._config.ipod_mount)
-
+ self.alternativeMountpoint = None
self.itdb = None
self.podcast_playlist = None
-
+
+ self.mountPoints = str(self._config.ipod_mount).split(";")
+ self.mountpoint = self.mountPoints[0]
+ if len(self.mountPoints)>1:
+ self.alternativeMountpoint = self.mountPoints[1]
def get_free_space(self):
# Reserve 10 MiB for iTunesDB writing (to be on the safe side)
@@ -279,15 +282,29 @@ class iPodDevice(Device):
def open(self):
Device.open(self)
- if not gpod_available or not os.path.isdir(self.mountpoint):
+ if not gpod_available:
return False
+ mountpoint_real = []
+ for mountpoint in self.mountPoints:
+ if os.path.isdir(mountpoint):
+ mountpoint_real.append(mountpoint)
+ if not mountpoint_real:
+ return False
+
+ print mountpoint_real
+
self.notify('status', _('Opening iPod database'))
- self.itdb = gpod.itdb_parse(self.mountpoint, None)
+ for mountpoint in mountpoint_real:
+ self.itdb = gpod.itdb_parse(mountpoint, None)
+ if self.itdb:
+ self.itdb.mountpoint = mountpoint
+ self.mountpoint = mountpoint
+ break
+
if self.itdb is None:
return False
- self.itdb.mountpoint = self.mountpoint
self.podcasts_playlist = gpod.itdb_playlist_podcasts(self.itdb)
if self.podcasts_playlist:
--
1.6.0.4
From 245d4eace5592e0ae77711924b4e9aa3c62c7c2d Mon Sep 17 00:00:00 2001
From: Paul Holt <p...@bob.(none)>
Date: Mon, 17 Aug 2009 22:45:49 +1000
Subject: [PATCH] Removed unused variable
---
src/gpodder/sync.py | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/gpodder/sync.py b/src/gpodder/sync.py
index 05a71c9..7eaf740 100644
--- a/src/gpodder/sync.py
+++ b/src/gpodder/sync.py
@@ -266,14 +266,11 @@ class iPodDevice(Device):
def __init__(self, config):
Device.__init__(self, config)
- self.alternativeMountpoint = None
+ self.mountPoints = str(self._config.ipod_mount).split(";")
+ self.mountpoint = self.mountPoints[0]
self.itdb = None
self.podcast_playlist = None
- self.mountPoints = str(self._config.ipod_mount).split(";")
- self.mountpoint = self.mountPoints[0]
- if len(self.mountPoints)>1:
- self.alternativeMountpoint = self.mountPoints[1]
def get_free_space(self):
# Reserve 10 MiB for iTunesDB writing (to be on the safe side)
--
1.6.0.4
_______________________________________________
gpodder-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/gpodder-devel