database manage init

This commit is contained in:
Ruud
2014-02-11 22:19:55 +01:00
parent 8724076601
commit 96e8a909d8
26 changed files with 382 additions and 183 deletions
+3 -13
View File
@@ -12,7 +12,9 @@ log = CPLog(__name__)
class ProfilePlugin(Plugin):
to_dict = {'types': {}}
_database = {
'profile': ProfileIndex
}
def __init__(self):
addEvent('profile.all', self.all)
@@ -29,21 +31,9 @@ class ProfilePlugin(Plugin):
}"""}
})
addEvent('database.setup', self.databaseSetup)
addEvent('app.initialize', self.fill, priority = 90)
addEvent('app.load', self.forceDefaults)
def databaseSetup(self):
db = get_db()
try:
db.add_index(ProfileIndex(db.path, 'profile'))
except:
log.debug('Index already exists')
db.edit_index(ProfileIndex(db.path, 'profile'))
def forceDefaults(self):
# Get all active movies without profile