Don't force register Growl
This commit is contained in:
1 parent
0d7cf6f3a4
commit
d4a4662e62
1 file changed
+18
-16
@@ -3,8 +3,6 @@ from couchpotato.core.logger import CPLog
|
|||||||
from couchpotato.core.notifications.base import Notification
|
from couchpotato.core.notifications.base import Notification
|
||||||
from gntp import notifier
|
from gntp import notifier
|
||||||
import logging
|
import logging
|
||||||
import thread
|
|
||||||
import time
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
@@ -12,31 +10,35 @@ log = CPLog(__name__)
|
|||||||
|
|
||||||
class Growl(Notification):
|
class Growl(Notification):
|
||||||
|
|
||||||
|
registered = False
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Growl, self).__init__()
|
super(Growl, self).__init__()
|
||||||
|
|
||||||
logging.getLogger('gntp').setLevel(logging.WARNING)
|
logging.getLogger('gntp').setLevel(logging.WARNING)
|
||||||
|
|
||||||
|
if self.isEnabled():
|
||||||
|
self.register()
|
||||||
|
|
||||||
|
def register(self):
|
||||||
|
if self.registered: return
|
||||||
try:
|
try:
|
||||||
def startGrowl():
|
self.growl = notifier.GrowlNotifier(
|
||||||
time.sleep(2)
|
applicationName = 'CouchPotato',
|
||||||
try:
|
notifications = ["Updates"],
|
||||||
self.growl = notifier.GrowlNotifier(
|
defaultNotifications = ["Updates"],
|
||||||
applicationName = 'CouchPotato',
|
applicationIcon = '%s/static/images/couch.png' % fireEvent('app.api_url', single = True),
|
||||||
notifications = ["Updates"],
|
)
|
||||||
defaultNotifications = ["Updates"],
|
self.growl.register()
|
||||||
applicationIcon = '%s/static/images/couch.png' % fireEvent('app.api_url', single = True),
|
self.registered = True
|
||||||
)
|
|
||||||
self.growl.register()
|
|
||||||
except:
|
|
||||||
log.error('Failed register of growl: %s' % traceback.format_exc())
|
|
||||||
thread.start_new_thread(startGrowl, ())
|
|
||||||
except:
|
except:
|
||||||
pass
|
log.error('Failed register of growl: %s' % traceback.format_exc())
|
||||||
|
|
||||||
def notify(self, type = '', message = '', data = {}):
|
def notify(self, type = '', message = '', data = {}):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
|
|
||||||
|
self.register()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.growl.notify(
|
self.growl.notify(
|
||||||
noteType = "Updates",
|
noteType = "Updates",
|
||||||
|
|||||||
Reference in new issue
Block a user