mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
calibredb: Handle the case when the user specifies the same to delete id multiple times
This commit is contained in:
parent
a3ff5086bd
commit
39fc7f0cf6
@ -386,7 +386,7 @@ def command_remove(args, dbpath):
|
|||||||
else:
|
else:
|
||||||
ids.append(int(y[0]))
|
ids.append(int(y[0]))
|
||||||
|
|
||||||
do_remove(get_db(dbpath, opts), ids)
|
do_remove(get_db(dbpath, opts), set(ids))
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -921,9 +921,12 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
'''
|
'''
|
||||||
Removes book from the result cache and the underlying database.
|
Removes book from the result cache and the underlying database.
|
||||||
'''
|
'''
|
||||||
path = os.path.join(self.library_path, self.path(id, index_is_id=True))
|
try:
|
||||||
|
path = os.path.join(self.library_path, self.path(id, index_is_id=True))
|
||||||
|
except:
|
||||||
|
path = None
|
||||||
self.data.remove(id)
|
self.data.remove(id)
|
||||||
if os.path.exists(path):
|
if path and os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
winshell.delete_file(path, no_confirm=True, silent=True)
|
winshell.delete_file(path, no_confirm=True, silent=True)
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user