mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
we need to count up for downloads
as we're streaming changes we don't know the total amount of downloads required
This commit is contained in:
parent
cf801e4fb4
commit
3ee1937310
1 changed files with 7 additions and 5 deletions
12
anki/sync.py
12
anki/sync.py
|
@ -741,6 +741,7 @@ class MediaSyncer(object):
|
|||
|
||||
# loop through and process changes from server
|
||||
self.col.log("last local usn is %s"%lastUsn)
|
||||
self.downloadCount = 0
|
||||
while True:
|
||||
data = self.server.mediaChanges(lastUsn=lastUsn)
|
||||
|
||||
|
@ -834,18 +835,19 @@ class MediaSyncer(object):
|
|||
def _downloadFiles(self, fnames):
|
||||
self.col.log("%d files to fetch"%len(fnames))
|
||||
while fnames:
|
||||
n = len(fnames)
|
||||
runHook("syncMsg", ngettext(
|
||||
"%d media file to download", "%d media files to download", n)
|
||||
% n)
|
||||
|
||||
top = fnames[0:SYNC_ZIP_COUNT]
|
||||
self.col.log("fetch %s"%top)
|
||||
zipData = self.server.downloadFiles(files=top)
|
||||
cnt = self.col.media.addFilesFromZip(zipData)
|
||||
self.downloadCount += cnt
|
||||
self.col.log("received %d files"%cnt)
|
||||
fnames = fnames[cnt:]
|
||||
|
||||
n = self.downloadCount
|
||||
runHook("syncMsg", ngettext(
|
||||
"%d media file downloaded", "%d media files downloaded", n)
|
||||
% n)
|
||||
|
||||
# Remote media syncing
|
||||
##########################################################################
|
||||
|
||||
|
|
Loading…
Reference in a new issue