calibredb catalog: Fix --ids and --search options not working for cvx/xml catalogs. Fixes #1955967 ['calibredb catalog' options broken: --ids and --search](https://bugs.launchpad.net/calibre/+bug/1955967)

This commit is contained in:
Kovid Goyal 2021-12-30 17:30:42 +05:30
parent 67cddcea52
commit 9dfa3f89db
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -512,7 +512,7 @@ class CatalogPlugin(Plugin): # {{{
db.search(opts.search_text)
if opts.sort_by:
if getattr(opts, 'sort_by', None):
# 2nd arg = ascending
db.sort(opts.sort_by, True)
return db.get_data_as_dict(ids=opts.ids)
@ -530,7 +530,7 @@ class CatalogPlugin(Plugin): # {{{
all_custom_fields.add(field+'_index')
all_fields = all_std_fields.union(all_custom_fields)
if opts.fields != 'all':
if getattr(opts, 'fields', 'all') != 'all':
# Make a list from opts.fields
of = [x.strip() for x in opts.fields.split(',')]
requested_fields = set(of)