mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix deleting books in newdb
This commit is contained in:
parent
2b8dc4505d
commit
c73123fcee
@ -320,8 +320,9 @@ class LibraryDatabase(object):
|
|||||||
|
|
||||||
def delete_book(self, book_id, notify=True, commit=True, permanent=False, do_clean=True):
|
def delete_book(self, book_id, notify=True, commit=True, permanent=False, do_clean=True):
|
||||||
self.new_api.remove_books((book_id,), permanent=permanent)
|
self.new_api.remove_books((book_id,), permanent=permanent)
|
||||||
|
self.data.books_deleted((book_id,))
|
||||||
if notify:
|
if notify:
|
||||||
self.notify('delete', [id])
|
self.notify('delete', [book_id])
|
||||||
|
|
||||||
def dirtied(self, book_ids, commit=True):
|
def dirtied(self, book_ids, commit=True):
|
||||||
self.new_api.mark_as_dirty(frozenset(book_ids) if book_ids is not None else book_ids)
|
self.new_api.mark_as_dirty(frozenset(book_ids) if book_ids is not None else book_ids)
|
||||||
|
@ -339,3 +339,17 @@ class View(object):
|
|||||||
pass
|
pass
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def remove(self, book_id):
|
||||||
|
try:
|
||||||
|
self._map = tuple(bid for bid in self._map if bid != book_id)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
self._map_filtered = tuple(bid for bid in self._map_filtered if bid != book_id)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def books_deleted(self, ids):
|
||||||
|
for book_id in ids:
|
||||||
|
self.remove(book_id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user