Disabled notification

This commit is contained in:
Ruud
2011-08-30 14:23:57 +02:00
parent 623f8c9d95
commit 18825f7a6d
10 changed files with 16 additions and 10 deletions
+3 -4
View File
@@ -25,7 +25,7 @@ class Notification(Plugin):
if not listener in self.dont_listen_to:
addEvent(listener, self.notify)
def notify(self, message = '', data = {}, type = ''):
def notify(self, message = '', data = {}):
pass
def test(self):
@@ -36,11 +36,10 @@ class Notification(Plugin):
success = self.notify(
message = self.test_message,
data = {},
type = test_type
data = {}
)
return jsonified({'success': success})
#return jsonified({'success': success})
def testNotifyName(self):
return 'notify.%s.test' % self.getName().lower()
@@ -16,6 +16,7 @@ class Growl(Notification):
return Env.setting(attr, 'growl')
def notify(self, message = '', data = {}):
if self.isDisabled(): return
hosts = [x.strip() for x in self.conf('host').split(",")]
password = self.conf('password')
@@ -3,6 +3,7 @@ from couchpotato.core.event import addEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
from couchpotato.core.settings.model import History as Hist
from couchpotato.environment import Env
import time
log = CPLog(__name__)
@@ -13,11 +14,10 @@ class History(Notification):
listen_to = ['movie.downloaded', 'movie.snatched', 'renamer.canceled']
def __init__(self):
super(Notification, self).__init__()
addEvent('notify', self.notify)
addEvent('app.load', self.test)
if Env.doDebug():
addEvent('app.load', self.test)
def notify(self, message = '', data = {}):
@@ -25,7 +25,6 @@ class History(Notification):
history = Hist(
added = int(time.time()),
message = message,
type = type,
release_id = data.get('id', 0)
)
db.add(history)
@@ -74,6 +74,7 @@ class NMJ(Notification):
})
def notify(self, message = '', data = {}):
if self.isDisabled(): return
host = self.conf('host')
mount = self.conf('mount')
@@ -20,6 +20,7 @@ class Notifo(Notification):
return Env.setting(attr, 'notifo')
def notify(self, message = '', data = {}):
if self.isDisabled(): return
try:
data = urllib.urlencode({
@@ -1,6 +1,6 @@
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
from libs import pynma
import pynma
log = CPLog(__name__)
@@ -8,6 +8,7 @@ log = CPLog(__name__)
class NotifyMyAndroid(Notification):
def notify(self, message = '', data = {}):
if self.isDisabled(): return
nma = pynma.PyNMA()
keys = self.conf('api_key').split(',')
@@ -11,6 +11,7 @@ log = CPLog(__name__)
class Plex(Notification):
def notify(self, message = '', data = {}):
if self.isDisabled(): return
log.info('Sending notification to Plex')
hosts = [x.strip() for x in self.conf('host').split(",")]
@@ -10,6 +10,7 @@ log = CPLog(__name__)
class Prowl(Notification):
def notify(self, message = '', data = {}):
if self.isDisabled(): return
http_handler = HTTPSConnection('api.prowlapp.com')
@@ -20,6 +20,7 @@ class Twitter(Notification):
}
def notify(self, message = '', data = {}):
if self.isDisabled(): return
api = Api(self.consumer_key, self.consumer_secret, self.conf('username'), self.conf('password'))
@@ -10,6 +10,7 @@ log = CPLog(__name__)
class XBMC(Notification):
def notify(self, message = '', data = {}):
if self.isDisabled(): return
for host in [x.strip() for x in self.conf('host').split(",")]:
self.send({'command': 'ExecBuiltIn', 'parameter': 'Notification(CouchPotato, %s)' % message}, host)