calibredb: Handle the case when the user specifies the same to delete id multiple times

This commit is contained in:
Kovid Goyal 2009-09-10 17:39:50 -06:00
parent a3ff5086bd
commit 39fc7f0cf6
2 changed files with 6 additions and 3 deletions

View File

@ -386,7 +386,7 @@ def command_remove(args, dbpath):
else:
ids.append(int(y[0]))
do_remove(get_db(dbpath, opts), ids)
do_remove(get_db(dbpath, opts), set(ids))
return 0

View File

@ -921,9 +921,12 @@ class LibraryDatabase2(LibraryDatabase):
'''
Removes book from the result cache and the underlying database.
'''
try:
path = os.path.join(self.library_path, self.path(id, index_is_id=True))
except:
path = None
self.data.remove(id)
if os.path.exists(path):
if path and os.path.exists(path):
try:
winshell.delete_file(path, no_confirm=True, silent=True)
except: