mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nicer error message when virtual library has no books
Fixes #1220030 [Content Server No Books Error](https://bugs.launchpad.net/calibre/+bug/1220030)
This commit is contained in:
parent
2023fb01d0
commit
28b104d10d
@ -675,6 +675,16 @@ class BrowseServer(object):
|
||||
which = unhexlify(cid).decode('utf-8')
|
||||
vls = self.db.prefs.get('virtual_libraries', {})
|
||||
ids = self.search_cache(vls[which])
|
||||
if not ids:
|
||||
msg = _('The virtual library <b>%s</b> has no books.') % prepare_string_for_xml(which)
|
||||
if self.search_restriction:
|
||||
msg += ' ' + _(
|
||||
'This is probably because you have applied a virtual library'
|
||||
' to the content server in Preferences->Sharing over the net.'
|
||||
' This virtual library is applied globally and combined with'
|
||||
' the current virtual library.')
|
||||
return self.browse_template('name').format(title='',
|
||||
script='', main='<p>%s</p>'%msg)
|
||||
else:
|
||||
if fm.get(category, {'datatype':None})['datatype'] == 'composite':
|
||||
cid = cid.decode('utf-8')
|
||||
|
Loading…
x
Reference in New Issue
Block a user