add only option, notify after each file again
This commit is contained in:
parent
fe5da620b2
commit
5e44a82408
1 changed files with 5 additions and 3 deletions
|
@ -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):
|
||||
'''
|
||||
|
|
Loading…
Reference in a new issue