diff --git a/plexpy/__init__.py b/plexpy/__init__.py index c32e229e..58b2661b 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -37,6 +37,7 @@ import config import database import logger import notification_handler +import notifiers import plextv import pmsconnect import versioncheck @@ -162,6 +163,9 @@ def initialize(config_file): except Exception as e: logger.error(u"Could not perform upgrades: %s" % e) + # Add notifier configs to logger blacklist + notifiers.blacklist_logger() + # Check if PlexPy has a uuid if CONFIG.PMS_UUID == '' or not CONFIG.PMS_UUID: my_uuid = generate_uuid() diff --git a/plexpy/config.py b/plexpy/config.py index cb0295c3..8d267e47 100644 --- a/plexpy/config.py +++ b/plexpy/config.py @@ -594,7 +594,7 @@ _CONFIG_DEFINITIONS = { 'XBMC_ON_NEWDEVICE': (int, 'XBMC', 0) } -_BLACKLIST_KEYS = ['_APITOKEN', '_TOKEN', '_KEY', '_SECRET', '_PASSWORD', '_APIKEY', '_ID'] +_BLACKLIST_KEYS = ['_APITOKEN', '_TOKEN', '_KEY', '_SECRET', '_PASSWORD', '_APIKEY', '_ID', '_HOOK'] _WHITELIST_KEYS = ['HTTPS_KEY', 'UPDATE_SECTION_IDS'] @@ -659,7 +659,7 @@ class Config(object): subkey.upper() not in _WHITELIST_KEYS and any(bk in subkey.upper() for bk in _BLACKLIST_KEYS): blacklist.append(value.strip()) - logger._BLACKLIST_WORDS = blacklist + logger._BLACKLIST_WORDS.extend(blacklist) def _define(self, name): key = name.upper() diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 95a94022..c8e2fb86 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -44,6 +44,7 @@ import database import helpers import logger import request +from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS from plexpy.helpers import checked AGENT_IDS = {'growl': 0, @@ -503,6 +504,23 @@ def send_notification(notifier_id=None, subject='', body='', action='', **kwargs logger.debug(u"PlexPy Notifiers :: Notification requested but no notifier_id received.") +def blacklist_logger(): + monitor_db = database.MonitorDatabase() + notifiers = monitor_db.select('SELECT notifier_config FROM notifiers') + + blacklist = [] + blacklist_keys = [w.lstrip('_') for w in _BLACKLIST_KEYS] + + for n in notifiers: + config = json.loads(n['notifier_config'] or '{}') + for key, value in config.iteritems(): + if isinstance(value, basestring) and len(value.strip()) > 5 and \ + key.upper() not in _WHITELIST_KEYS and any(bk in key.upper() for bk in blacklist_keys): + blacklist.append(value.strip()) + + logger._BLACKLIST_WORDS.extend(blacklist) + + class PrettyMetadata(object): def __init__(self, parameters): self.parameters = parameters