mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
remove_cover()
This commit is contained in:
parent
f75458224b
commit
93e68b1398
@ -664,6 +664,11 @@ class LibraryDatabase(object):
|
|||||||
if changed and notify:
|
if changed and notify:
|
||||||
self.notify('metadata', [])
|
self.notify('metadata', [])
|
||||||
|
|
||||||
|
def remove_cover(self, book_id, notify=True, commit=True):
|
||||||
|
self.new_api.set_cover({book_id:None})
|
||||||
|
if notify:
|
||||||
|
self.notify('cover', [id])
|
||||||
|
|
||||||
# Private interface {{{
|
# Private interface {{{
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
for row in self.data.iterall():
|
for row in self.data.iterall():
|
||||||
|
@ -345,6 +345,12 @@ class LegacyTest(BaseTest):
|
|||||||
self.assertEqual(cache.field_for('authors', bid), ('calibre',))
|
self.assertEqual(cache.field_for('authors', bid), ('calibre',))
|
||||||
self.assertEqual(cache.field_for('tags', bid), (_('News'), 'Events', 'one', 'two'))
|
self.assertEqual(cache.field_for('tags', bid), (_('News'), 'Events', 'one', 'two'))
|
||||||
|
|
||||||
|
self.assertTrue(legacy.cover(1, index_is_id=True))
|
||||||
|
self.assertTrue(legacy.has_cover(1))
|
||||||
|
legacy.remove_cover(1)
|
||||||
|
self.assertFalse(legacy.has_cover(1))
|
||||||
|
self.assertFalse(legacy.cover(1, index_is_id=True))
|
||||||
|
|
||||||
legacy.delete_book(1)
|
legacy.delete_book(1)
|
||||||
old.delete_book(1)
|
old.delete_book(1)
|
||||||
self.assertNotIn(1, legacy.all_ids())
|
self.assertNotIn(1, legacy.all_ids())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user