mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-16 05:04:43 +01:00
Compare commits
2 commits
b2950eaeee
...
5fe9010e74
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fe9010e74 | ||
|
|
f8f971d208 |
1 changed files with 14 additions and 1 deletions
|
|
@ -437,6 +437,11 @@ def on_complete(end_type, xhr, ev):
|
|||
self.downloads_in_progress.remove(xhr)
|
||||
progress_track[this] = raster_cover_size if this is raster_cover_name else files[this].size
|
||||
update_progress()
|
||||
if len(queued):
|
||||
for fname in queued:
|
||||
start_download(fname, base_path + encodeURIComponent(fname).replace(/%2[fF]/g, '/'))
|
||||
queued.discard(fname)
|
||||
break
|
||||
if end_type is 'abort':
|
||||
files_left.discard(this)
|
||||
return
|
||||
|
|
@ -469,9 +474,17 @@ def start_download(fname, path):
|
|||
if raster_cover_name:
|
||||
start_download(raster_cover_name, 'get/cover/' + book_id + '/' + encodeURIComponent(library_id))
|
||||
|
||||
count = 0
|
||||
queued = set()
|
||||
for fname in files_left:
|
||||
if fname is not raster_cover_name:
|
||||
start_download(fname, base_path + encodeURIComponent(fname).replace(/%2[fF]/g, '/'))
|
||||
count += 1
|
||||
# Chrome starts killing AJAX requests if there are too many in flight, unlike Firefox
|
||||
# which is smart enough to queue them
|
||||
if count < 20:
|
||||
start_download(fname, base_path + encodeURIComponent(fname).replace(/%2[fF]/g, '/'))
|
||||
else:
|
||||
queued.add(fname)
|
||||
|
||||
def ensure_maths(self, proceed):
|
||||
self.db.get_mathjax_info(def(mathjax_info):
|
||||
|
|
|
|||
Loading…
Reference in a new issue