diff --git a/plexpy/__init__.py b/plexpy/__init__.py index a110559e..c55d7c0f 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -1070,9 +1070,9 @@ def dbcheck(): # Upgrade notifiers table from earlier versions try: - c_db.execute('SELECT custom_condition FROM notifiers') + c_db.execute('SELECT custom_conditions FROM notifiers') except sqlite3.OperationalError: - logger.debug(u"Altering database. Updating database table custom_condition.") + logger.debug(u"Altering database. Updating database table notifiers.") c_db.execute( 'ALTER TABLE notifiers ADD COLUMN custom_conditions TEXT' ) diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 67b088b8..a10ed13d 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -2950,10 +2950,16 @@ class WebInterface(object): def get_notifier_config_modal(self, notifier_id=None, **kwargs): result = notifiers.get_notifier_config(notifier_id=notifier_id) - parameters = [ - {'name': param['name'], 'type': param['type'], 'value': param['value']} - for category in common.NOTIFICATION_PARAMETERS - for param in category['parameters'] + if not result['custom_conditions']: + result['custom_conditions'] = json.dumps([{'coefficient': '', 'operator': '', 'value': ''}]) + + if not result['custom_conditions_logic']: + result['custom_conditions_logic'] = '' + + parameters = [{'name': '', 'type': '', 'value': ''}] + parameters += [ + {'name': param['name'], 'type': param['type'], 'value': param['value']} + for category in common.NOTIFICATION_PARAMETERS for param in category['parameters'] ] return serve_template(templatename="notifier_config.html", notifier=result, parameters=json.dumps(parameters))