mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Change notification for saved searches
This commit is contained in:
parent
7ebd16989d
commit
71d9ac0adc
@ -8,6 +8,7 @@ readonly = False
|
|||||||
version = 0 # change this if you change signature of implementation()
|
version = 0 # change this if you change signature of implementation()
|
||||||
|
|
||||||
from calibre import prints
|
from calibre import prints
|
||||||
|
from calibre.srv.changes import saved_searches
|
||||||
|
|
||||||
|
|
||||||
def implementation(db, notify_changes, action, *args):
|
def implementation(db, notify_changes, action, *args):
|
||||||
@ -18,10 +19,14 @@ def implementation(db, notify_changes, action, *args):
|
|||||||
if action == 'add':
|
if action == 'add':
|
||||||
name, val = args
|
name, val = args
|
||||||
db.saved_search_add(name, val)
|
db.saved_search_add(name, val)
|
||||||
|
if notify_changes is not None:
|
||||||
|
notify_changes(saved_searches([('add', name)]))
|
||||||
return
|
return
|
||||||
if action == 'remove':
|
if action == 'remove':
|
||||||
name = args[0]
|
name = args[0]
|
||||||
db.saved_search_delete(name)
|
db.saved_search_delete(name)
|
||||||
|
if notify_changes is not None:
|
||||||
|
notify_changes(saved_searches([('remove', name)]))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,3 +25,9 @@ def books_deleted(book_ids):
|
|||||||
|
|
||||||
def metadata(book_ids):
|
def metadata(book_ids):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def saved_searches(changes):
|
||||||
|
for change_type, saved_search_name in changes:
|
||||||
|
# change_type is one of 'add' or 'remove'
|
||||||
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user