mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Handle book still being processed on server
This commit is contained in:
parent
3eac3b3c53
commit
fb25c0aaae
@ -90,6 +90,10 @@ class ReadUI:
|
|||||||
pr.removeAttribute('value'), pr.removeAttribute('max')
|
pr.removeAttribute('value'), pr.removeAttribute('max')
|
||||||
div.lastChild.textContent = _('Downloading book manifest...')
|
div.lastChild.textContent = _('Downloading book manifest...')
|
||||||
|
|
||||||
|
def show_progress_message(self, msg):
|
||||||
|
div = document.getElementById(self.progress_id)
|
||||||
|
div.lastChild.textContent = msg or ''
|
||||||
|
|
||||||
def load_book(self, book_id, fmt, metadata):
|
def load_book(self, book_id, fmt, metadata):
|
||||||
if self.db is None:
|
if self.db is None:
|
||||||
self.pending_load = [book_id, fmt, metadata]
|
self.pending_load = [book_id, fmt, metadata]
|
||||||
@ -144,12 +148,28 @@ class ReadUI:
|
|||||||
return self.show_error(_('Failed to load book manifest'),
|
return self.show_error(_('Failed to load book manifest'),
|
||||||
_('The manifest for {title} is not valid').format(title=self.current_metadata.title),
|
_('The manifest for {title} is not valid').format(title=self.current_metadata.title),
|
||||||
traceback.format_exc())
|
traceback.format_exc())
|
||||||
|
if manifest.version is not undefined:
|
||||||
if manifest.version is not RENDER_VERSION:
|
if manifest.version is not RENDER_VERSION:
|
||||||
print('calibre upgraded: RENDER_VERSION={} manifest.version={}'.format(RENDER_VERSION, manifest.version))
|
print('calibre upgraded: RENDER_VERSION={} manifest.version={}'.format(RENDER_VERSION, manifest.version))
|
||||||
return self.show_error(_('calibre upgraded!'), _(
|
return self.show_error(_('calibre upgraded!'), _(
|
||||||
'A newer version of calibre is available, please click the reload button in your browser.'))
|
'A newer version of calibre is available, please click the reload button in your browser.'))
|
||||||
self.current_metadata = manifest.metadata
|
self.current_metadata = manifest.metadata
|
||||||
self.db.save_manifest(book, manifest, self.download_book.bind(self, book))
|
self.db.save_manifest(book, manifest, self.download_book.bind(self, book))
|
||||||
|
return
|
||||||
|
# Book is still being processed
|
||||||
|
msg = _('Downloading book manifest...')
|
||||||
|
if manifest.job_status is 'finished':
|
||||||
|
if manifest.aborted:
|
||||||
|
return self.show_error(_('Failed to prepare book for reading'), _('Preparation of book for reading was aborted because it took too long'))
|
||||||
|
if manifest.traceback:
|
||||||
|
return self.show_error(_('Failed to prepare book for reading'), _(
|
||||||
|
'There was an error processing the book, click "Show details" for more information'), manifest.traceback or '')
|
||||||
|
elif manifest.job_status is 'waiting':
|
||||||
|
msg = _('Book is queued for processing on the server...')
|
||||||
|
elif manifest.job_status is 'running':
|
||||||
|
msg = _('Book is being prepared for reading on the server...')
|
||||||
|
self.show_progress_message(msg)
|
||||||
|
setTimeout(self.get_manifest.bind(self, book), 100)
|
||||||
|
|
||||||
def download_book(self, book):
|
def download_book(self, book):
|
||||||
files = book.manifest.files
|
files = book.manifest.files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user