Allow calibredb list to output only book ids

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2013-07-27 15:19:56 +05:30
commit 694dfe5dc2
2 changed files with 13 additions and 10 deletions

View File

@ -921,7 +921,7 @@ class ResultCache(SearchQueryParser): # {{{
def remove(self, id):
try:
self._uuid_map.pop(self._data[id][self._uuid_column_index], None)
except IndexError:
except (IndexError, TypeError):
pass # id is out of bounds -- no uuid in the map to remove
try:
self._data[id] = None

View File

@ -199,15 +199,18 @@ def command_list(args, dbpath):
afields.add('*'+f)
if data['datatype'] == 'series':
afields.add('*'+f+'_index')
fields = [str(f.strip().lower()) for f in opts.fields.split(',')]
if 'all' in fields:
fields = sorted(list(afields))
if not set(fields).issubset(afields):
parser.print_help()
print
prints(_('Invalid fields. Available fields:'),
','.join(sorted(afields)), file=sys.stderr)
return 1
if opts.fields.strip():
fields = [str(f.strip().lower()) for f in opts.fields.split(',')]
if 'all' in fields:
fields = sorted(list(afields))
if not set(fields).issubset(afields):
parser.print_help()
print
prints(_('Invalid fields. Available fields:'),
','.join(sorted(afields)), file=sys.stderr)
return 1
else:
fields = []
if not opts.sort_by in afields and opts.sort_by is not None:
parser.print_help()