move database_change events back to library.py

dbcore is abstractable. Should not depend on any beets internals.
This commit is contained in:
Adrian Sampson 2014-01-13 15:04:48 -08:00
parent c5b92919c6
commit f46c8b0623
2 changed files with 12 additions and 1 deletions

View file

@ -511,7 +511,6 @@ class Transaction(object):
the row ID of the last affected row.
"""
cursor = self.lib._connection().execute(statement, subvals)
plugins.send('database_change', lib=self.lib)
return cursor.lastrowid
def script(self, statements):

View file

@ -204,6 +204,18 @@ class LibModel(dbcore.Model):
funcs.update(plugins.template_funcs())
return funcs
def store(self):
super(LibModel, self).store()
plugins.send('database_change', lib=self.lib)
def remove(self):
super(LibModel, self).remove()
plugins.send('database_change', lib=self.lib)
def add(self, lib=None):
super(LibModel, self).add(lib)
plugins.send('database_change', lib=self.lib)
class Item(LibModel):
_fields = ITEM_KEYS