add only option, notify after each file again

This commit is contained in:
j 2008-06-01 22:26:10 +02:00
parent fe5da620b2
commit 5e44a82408

View file

@ -187,6 +187,7 @@ class Archive(SQLObject):
print self.addFile(meta), f.encode('utf-8') print self.addFile(meta), f.encode('utf-8')
stats['added'] += 1 stats['added'] += 1
md5sum_on_disk.append(meta['md5sum']) md5sum_on_disk.append(meta['md5sum'])
self.notifyFrontend('add', meta['md5sum'])
for f in oxdb_files: for f in oxdb_files:
if oxdb_files[f]['md5sum'] not in md5sum_on_disk: if oxdb_files[f]['md5sum'] not in md5sum_on_disk:
print "remove", f.encode('utf-8') print "remove", f.encode('utf-8')
@ -212,7 +213,7 @@ class Archive(SQLObject):
for f in self.files: for f in self.files:
self.notifyFrontend('add', f.md5sum) self.notifyFrontend('add', f.md5sum)
def syncFrontend(self): def syncFrontend(self, addOnly=False):
dto = socket.getdefaulttimeout() dto = socket.getdefaulttimeout()
socket.setdefaulttimeout(256) socket.setdefaulttimeout(256)
data = getUrl("%s/list" % self.baseUrlFrontend) data = getUrl("%s/list" % self.baseUrlFrontend)
@ -223,8 +224,9 @@ class Archive(SQLObject):
f = ArchiveFile.byMd5sum(md5sum) f = ArchiveFile.byMd5sum(md5sum)
except SQLObjectNotFound: except SQLObjectNotFound:
self.notifyFrontend('remove', md5sum) self.notifyFrontend('remove', md5sum)
for f in ArchiveFile.select(NOT(IN(ArchiveFile.q.md5sum, md5sums))): if not addOnly:
self.notifyFrontend('add', f.md5sum) for f in ArchiveFile.select(NOT(IN(ArchiveFile.q.md5sum, md5sums))):
self.notifyFrontend('add', f.md5sum)
class ArchiveFile(SQLObject): class ArchiveFile(SQLObject):
''' '''