[conduit] Fixed iPodModule to allow track replacing (pass tests) and added iPodVideo to tests.
- From: Alexandre Rosenfeld <arosenfeld src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit] Fixed iPodModule to allow track replacing (pass tests) and added iPodVideo to tests.
- Date: Sun, 7 Jun 2009 16:47:17 -0400 (EDT)
commit eb627a288f1455de9d890f9eb221294052c61bb1
Author: Alexandre Rosenfeld <airmind gmail com>
Date: Sun Jun 7 17:46:13 2009 -0300
Fixed iPodModule to allow track replacing (pass tests) and added iPodVideo to tests.
---
conduit/modules/iPodModule/iPodModule.py | 17 +++++++++++++----
test/soup/modules/ipod.py | 6 ++++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/conduit/modules/iPodModule/iPodModule.py b/conduit/modules/iPodModule/iPodModule.py
index 2363023..05a8978 100644
--- a/conduit/modules/iPodModule/iPodModule.py
+++ b/conduit/modules/iPodModule/iPodModule.py
@@ -562,7 +562,7 @@ class IPodFileBase:
'''
tags = f.get_media_tags()
for name, value in self._convert_tags(tags, self.media_to_ipod):
- log.debug("Got %s = %s" % (name, value))
+ #log.debug("Got %s = %s" % (name, value))
self.track[name] = value
#Make sure we have a title to this song, even if it's just the filename
if self.track['title'] is None:
@@ -580,6 +580,12 @@ class IPodFileBase:
filename = self.track._userdata_into_default_locale('filename')
return filename
+ def get_hash(self):
+ return str(hash(tuple(self.get_media_tags())))
+
+ def get_snippet(self):
+ return "%(artist)s - %(title)s" % track
+
def get_media_tags(self):
'''
Extends the MediaFile class to include the iPod metadata, instead of
@@ -766,9 +772,12 @@ class IPodMediaTwoWay(IPodBase):
def put(self, f, overwrite, LUID=None):
self.get_db()
try:
- media_file = self._ipodmedia_(db = self.db, f = f, **self.track_args)
- #FIXME: We keep the db locked while we copy the file. Not good
- #media_file.
+ if LUID and LUID in self.tracks_id:
+ track = self.tracks_id[LUID]
+ media_file = self._ipodmedia_(db = self.db, track = track, f = f, **self.track_args)
+ else:
+ media_file = self._ipodmedia_(db = self.db, f = f, **self.track_args)
+ #FIXME: We keep the db locked while we copy the file. Not good.
media_file.copy_ipod()
self.tracks_id[str(media_file.track['dbid'])] = media_file.track
#FIXME: Writing the db here is for debug only. Closing does not actually
diff --git a/test/soup/modules/ipod.py b/test/soup/modules/ipod.py
index b30c12d..4705d8e 100644
--- a/test/soup/modules/ipod.py
+++ b/test/soup/modules/ipod.py
@@ -7,6 +7,7 @@ from soup.data.contact import ContactWrapper
from soup.data.event import EventWrapper
from soup.data.photo import PhotoWrapper
from soup.data.music import MusicWrapper
+from soup.data.video import VideoWrapper
import conduit.modules.iPodModule.iPodModule as iPodModule
import conduit.utils as Utils
@@ -51,3 +52,8 @@ class iPodMusic(soup.modules.ModuleWrapper, iPodWrapper):
dataclass = MusicWrapper
requires = [GpodModule]
+class iPodVideo(soup.modules.ModuleWrapper, iPodWrapper):
+ klass = iPodModule.IPodVideoTwoWay
+ dataclass = VideoWrapper
+ requires = [GpodModule]
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]