mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1160452 (set_custom produces traceback if ID not in library)
This commit is contained in:
parent
c936ad2c1c
commit
954c64c156
@ -592,6 +592,9 @@ def command_set_metadata(args, dbpath):
|
|||||||
print >>sys.stderr, _('You must specify either a field or an opf file')
|
print >>sys.stderr, _('You must specify either a field or an opf file')
|
||||||
return 1
|
return 1
|
||||||
book_id = int(args[1])
|
book_id = int(args[1])
|
||||||
|
if book_id not in db.all_ids():
|
||||||
|
prints(_('No book with id: %s in the database')%book_id, file=sys.stderr)
|
||||||
|
raise SystemExit(1)
|
||||||
|
|
||||||
if len(args) > 2:
|
if len(args) > 2:
|
||||||
opf = args[2]
|
opf = args[2]
|
||||||
@ -870,6 +873,9 @@ def parse_series_string(db, label, value):
|
|||||||
return val, s_index
|
return val, s_index
|
||||||
|
|
||||||
def do_set_custom(db, col, id_, val, append):
|
def do_set_custom(db, col, id_, val, append):
|
||||||
|
if id_ not in db.all_ids():
|
||||||
|
prints(_('No book with id: %s in the database')%id_, file=sys.stderr)
|
||||||
|
raise SystemExit(1)
|
||||||
if db.custom_column_label_map[col]['datatype'] == 'series':
|
if db.custom_column_label_map[col]['datatype'] == 'series':
|
||||||
val, s_index = parse_series_string(db, col, val)
|
val, s_index = parse_series_string(db, col, val)
|
||||||
db.set_custom(id_, val, extra=s_index, label=col, append=append)
|
db.set_custom(id_, val, extra=s_index, label=col, append=append)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user