From 88520d488cf1f70d9bf4ebb90a3b65b7c0eaef95 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 26 Jul 2015 11:56:02 +0200 Subject: [PATCH] Don't show OSX Notification agent if we cannot use it. Fix. --- plexpy/notifiers.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 91ebe4de..72f01ed7 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -146,7 +146,7 @@ def available_notification_agents(): # OSX Notifications should only be visible if it can be used osx_notify = OSX_NOTIFY() - if osx_notify: + if osx_notify.validate(): agents.append({'name': 'OSX Notify', 'id': AGENT_IDS['OSX Notify'], 'config_prefix': 'osx_notify', @@ -981,6 +981,14 @@ class OSX_NOTIFY(object): try: self.objc = __import__("objc") self.AppKit = __import__("AppKit") + except: + logger.error(u"PlexPy Notifier :: Cannot load OSX Notifications agent.") + + def validate(self): + try: + self.objc = __import__("objc") + self.AppKit = __import__("AppKit") + return True except: return False