From 5e44a82408c63ad39848299190e191d8534f87ca Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 1 Jun 2008 22:26:10 +0200 Subject: [PATCH] add only option, notify after each file again --- oxdbarchive/model.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oxdbarchive/model.py b/oxdbarchive/model.py index a81ab7e..7ecd017 100644 --- a/oxdbarchive/model.py +++ b/oxdbarchive/model.py @@ -187,6 +187,7 @@ class Archive(SQLObject): print self.addFile(meta), f.encode('utf-8') stats['added'] += 1 md5sum_on_disk.append(meta['md5sum']) + self.notifyFrontend('add', meta['md5sum']) for f in oxdb_files: if oxdb_files[f]['md5sum'] not in md5sum_on_disk: print "remove", f.encode('utf-8') @@ -212,7 +213,7 @@ class Archive(SQLObject): for f in self.files: self.notifyFrontend('add', f.md5sum) - def syncFrontend(self): + def syncFrontend(self, addOnly=False): dto = socket.getdefaulttimeout() socket.setdefaulttimeout(256) data = getUrl("%s/list" % self.baseUrlFrontend) @@ -223,8 +224,9 @@ class Archive(SQLObject): f = ArchiveFile.byMd5sum(md5sum) except SQLObjectNotFound: self.notifyFrontend('remove', md5sum) - for f in ArchiveFile.select(NOT(IN(ArchiveFile.q.md5sum, md5sums))): - self.notifyFrontend('add', f.md5sum) + if not addOnly: + for f in ArchiveFile.select(NOT(IN(ArchiveFile.q.md5sum, md5sums))): + self.notifyFrontend('add', f.md5sum) class ArchiveFile(SQLObject): '''