summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortmzullinger <tmzullinger@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2008-08-23 18:01:32 +0000
committertmzullinger <tmzullinger@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2008-08-23 18:01:32 +0000
commit9a98fc1a1b4476dd57e226cfafaa283997732752 (patch)
tree18cd9ad6a26f869bf54b6e86b6f6aab5d6017d58
parenta784f5941d57b692338782b1955f5721aaabaa7d (diff)
downloadlibgpod-9a98fc1a1b4476dd57e226cfafaa283997732752.tar.gz
libgpod-9a98fc1a1b4476dd57e226cfafaa283997732752.tar.xz
libgpod-9a98fc1a1b4476dd57e226cfafaa283997732752.zip
Python: Add a quiet parameter to Database.remove() and use it in tests
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2109 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog9
-rw-r--r--bindings/python/ipod.py7
-rw-r--r--bindings/python/tests/tests.py2
3 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 44f6373..ef16b75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2008-08-09 Todd Zullinger <tmzullinger at users.sourceforge.net>
+2008-08-23 Todd Zullinger <tmzullinger at users.sourceforge.net>
+
+ * bindings/python/ipod.py
+ bindings/python/tests/tests.py:
+ Add a quiet parameter to Database.remove() and use it in
+ tests
+
+2008-08-20 Todd Zullinger <tmzullinger at users.sourceforge.net>
* bindings/python/examples/save_photos.py
bindings/python/gpod.i.in
diff --git a/bindings/python/ipod.py b/bindings/python/ipod.py
index 7048955..80b5858 100644
--- a/bindings/python/ipod.py
+++ b/bindings/python/ipod.py
@@ -155,7 +155,7 @@ class Database:
gpod.itdb_track_add(self._itdb, track._track, pos)
track.__database = self # so the db doesn't get gc'd
- def remove(self, item, harddisk=False, ipod=True):
+ def remove(self, item, harddisk=False, ipod=True, quiet=False):
"""Remove a playlist or track from a database.
item is either a playlist or track object.
@@ -164,6 +164,8 @@ class Database:
If ipod is True the item will be removed from the iPod.
+ If quiet is True no message will be printed for removed tracks
+
"""
if isinstance(item, Playlist):
@@ -189,7 +191,8 @@ class Database:
filename = item.ipod_filename()
if filename and os.path.exists(filename):
os.unlink(filename)
- print "unlinked %s" % filename
+ if not quiet:
+ print "unlinked %s" % filename
gpod.itdb_track_unlink(item._track)
else:
raise DatabaseException("Unable to remove a %s from database" % type(item))
diff --git a/bindings/python/tests/tests.py b/bindings/python/tests/tests.py
index 6efb114..657e7f5 100644
--- a/bindings/python/tests/tests.py
+++ b/bindings/python/tests/tests.py
@@ -62,7 +62,7 @@ class TestiPodFunctions(unittest.TestCase):
track = self.db[0]
track_file = track.ipod_filename()
self.assertEqual(len(self.db),n)
- self.db.remove(track, ipod=True)
+ self.db.remove(track, ipod=True, quiet=True)
self.failIf(os.path.exists(track_file))
def testDatestampSetting(self):