Add settings for notification conditions filterer

This commit is contained in:
JonnyWong16 2017-05-05 23:14:11 -07:00
parent 565dea5ecf
commit f3349c64a9
5 changed files with 90 additions and 9 deletions

View file

@ -517,7 +517,8 @@ def dbcheck():
'on_resume_body TEXT, on_buffer_body TEXT, on_watched_body TEXT, '
'on_created_body TEXT, on_extdown_body TEXT, on_intdown_body TEXT, '
'on_extup_body TEXT, on_intup_body TEXT, on_pmsupdate_body TEXT, '
'on_concurrent_body TEXT, on_newdevice_body TEXT, on_plexpyupdate_body TEXT)'
'on_concurrent_body TEXT, on_newdevice_body TEXT, on_plexpyupdate_body TEXT, '
'custom_conditions TEXT, custom_conditions_logic TEXT)'
)
# poster_urls table :: This table keeps record of the notification poster urls
@ -1067,6 +1068,18 @@ def dbcheck():
logger.warn(u"Failed to recreate mobile_devices table.")
pass
# Upgrade notifiers table from earlier versions
try:
c_db.execute('SELECT custom_condition FROM notifiers')
except sqlite3.OperationalError:
logger.debug(u"Altering database. Updating database table custom_condition.")
c_db.execute(
'ALTER TABLE notifiers ADD COLUMN custom_conditions TEXT'
)
c_db.execute(
'ALTER TABLE notifiers ADD COLUMN custom_conditions_logic TEXT'
)
# Add "Local" user to database as default unauthenticated user.
result = c_db.execute('SELECT id FROM users WHERE username = "Local"')
if not result.fetchone():