mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix #2008538 [Content Server: Better message for non-readable formats](https://bugs.launchpad.net/calibre/+bug/2008538)
This commit is contained in:
parent
b529a975e9
commit
491ee6ad98
@ -311,6 +311,7 @@ class ReadUI:
|
|||||||
|
|
||||||
def start_load(self, book_id, fmt, metadata, force_reload):
|
def start_load(self, book_id, fmt, metadata, force_reload):
|
||||||
self.current_book_id = book_id
|
self.current_book_id = book_id
|
||||||
|
self.current_book_fmt = fmt
|
||||||
metadata = metadata or library_data.metadata[book_id]
|
metadata = metadata or library_data.metadata[book_id]
|
||||||
self.current_metadata = metadata or {'title':_('Book id #') + book_id}
|
self.current_metadata = metadata or {'title':_('Book id #') + book_id}
|
||||||
update_window_title('', self.current_metadata.title)
|
update_window_title('', self.current_metadata.title)
|
||||||
@ -344,6 +345,12 @@ class ReadUI:
|
|||||||
if end_type is 'abort':
|
if end_type is 'abort':
|
||||||
return
|
return
|
||||||
if end_type is not 'load':
|
if end_type is not 'load':
|
||||||
|
if xhr.status is 404:
|
||||||
|
fmt = (self.current_book_fmt or 'UNKNOWN').toUpperCase()
|
||||||
|
if 'cannot be viewed' in xhr.error_html:
|
||||||
|
return self.show_error(
|
||||||
|
_('Failed to view book'), _('Viewing of the {} format is not supported.').format(fmt), xhr.error_html)
|
||||||
|
return self.show_error(_('Failed to view book'), _('The {} format is not available.').format(fmt), xhr.error_html)
|
||||||
return self.show_error(_('Failed to load book manifest'),
|
return self.show_error(_('Failed to load book manifest'),
|
||||||
_('The book manifest failed to load, click "Show details" for more information.').format(title=self.current_metadata.title),
|
_('The book manifest failed to load, click "Show details" for more information.').format(title=self.current_metadata.title),
|
||||||
xhr.error_html)
|
xhr.error_html)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user