diff --git a/couchpotato/core/notifications/boxcar/main.py b/couchpotato/core/notifications/boxcar.py
similarity index 57%
rename from couchpotato/core/notifications/boxcar/main.py
rename to couchpotato/core/notifications/boxcar.py
index 49aab31..f5006ef 100644
--- a/couchpotato/core/notifications/boxcar/main.py
+++ b/couchpotato/core/notifications/boxcar.py
@@ -33,3 +33,33 @@ class Boxcar(Notification):
def isEnabled(self):
return super(Boxcar, self).isEnabled() and self.conf('email')
+
+
+config = [{
+ 'name': 'boxcar',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'boxcar',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'email',
+ 'description': 'Your Boxcar registration emailaddress.'
+ },
+ {
+ 'name': 'on_snatch',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Also send message when movie is snatched.',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/boxcar/__init__.py b/couchpotato/core/notifications/boxcar/__init__.py
deleted file mode 100644
index faab7a5..0000000
--- a/couchpotato/core/notifications/boxcar/__init__.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from .main import Boxcar
-
-
-def start():
- return Boxcar()
-
-config = [{
- 'name': 'boxcar',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'boxcar',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'email',
- 'description': 'Your Boxcar registration emailaddress.'
- },
- {
- 'name': 'on_snatch',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Also send message when movie is snatched.',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/boxcar2/main.py b/couchpotato/core/notifications/boxcar2.py
similarity index 59%
rename from couchpotato/core/notifications/boxcar2/main.py
rename to couchpotato/core/notifications/boxcar2.py
index 6633ca7..3e19c19 100644
--- a/couchpotato/core/notifications/boxcar2/main.py
+++ b/couchpotato/core/notifications/boxcar2.py
@@ -4,6 +4,8 @@ from couchpotato.core.notifications.base import Notification
log = CPLog(__name__)
+autoload = 'Boxcar2'
+
class Boxcar2(Notification):
@@ -37,3 +39,33 @@ class Boxcar2(Notification):
def isEnabled(self):
return super(Boxcar2, self).isEnabled() and self.conf('token')
+
+
+config = [{
+ 'name': 'boxcar2',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'boxcar2',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'token',
+ 'description': ('Your Boxcar access token.', 'Can be found in the app under settings')
+ },
+ {
+ 'name': 'on_snatch',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Also send message when movie is snatched.',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/boxcar2/__init__.py b/couchpotato/core/notifications/boxcar2/__init__.py
deleted file mode 100644
index da7f99c..0000000
--- a/couchpotato/core/notifications/boxcar2/__init__.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from .main import Boxcar2
-
-
-def start():
- return Boxcar2()
-
-config = [{
- 'name': 'boxcar2',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'boxcar2',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'token',
- 'description': ('Your Boxcar access token.', 'Can be found in the app under settings')
- },
- {
- 'name': 'on_snatch',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Also send message when movie is snatched.',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/core/__init__.py b/couchpotato/core/notifications/core/__init__.py
index b68a915..9c4fb37 100644
--- a/couchpotato/core/notifications/core/__init__.py
+++ b/couchpotato/core/notifications/core/__init__.py
@@ -1,7 +1,5 @@
from .main import CoreNotifier
-def start():
+def autoload():
return CoreNotifier()
-
-config = []
diff --git a/couchpotato/core/notifications/email/main.py b/couchpotato/core/notifications/email.py
similarity index 57%
rename from couchpotato/core/notifications/email/main.py
rename to couchpotato/core/notifications/email.py
index b854401..0a9ff06 100644
--- a/couchpotato/core/notifications/email/main.py
+++ b/couchpotato/core/notifications/email.py
@@ -66,3 +66,67 @@ class Email(Notification):
log.error('E-mail failed: %s', traceback.format_exc())
return False
+
+
+config = [{
+ 'name': 'email',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'email',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'from',
+ 'label': 'Send e-mail from',
+ },
+ {
+ 'name': 'to',
+ 'label': 'Send e-mail to',
+ },
+ {
+ 'name': 'smtp_server',
+ 'label': 'SMTP server',
+ },
+ { 'name': 'smtp_port',
+ 'label': 'SMTP server port',
+ 'default': '25',
+ 'type': 'int',
+ },
+ {
+ 'name': 'ssl',
+ 'label': 'Enable SSL',
+ 'default': 0,
+ 'type': 'bool',
+ },
+ {
+ 'name': 'starttls',
+ 'label': 'Enable StartTLS',
+ 'default': 0,
+ 'type': 'bool',
+ },
+ {
+ 'name': 'smtp_user',
+ 'label': 'SMTP user',
+ },
+ {
+ 'name': 'smtp_pass',
+ 'label': 'SMTP password',
+ 'type': 'password',
+ },
+ {
+ 'name': 'on_snatch',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Also send message when movie is snatched.',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/email/__init__.py b/couchpotato/core/notifications/email/__init__.py
deleted file mode 100644
index aaf087b..0000000
--- a/couchpotato/core/notifications/email/__init__.py
+++ /dev/null
@@ -1,68 +0,0 @@
-from .main import Email
-
-
-def start():
- return Email()
-
-config = [{
- 'name': 'email',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'email',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'from',
- 'label': 'Send e-mail from',
- },
- {
- 'name': 'to',
- 'label': 'Send e-mail to',
- },
- {
- 'name': 'smtp_server',
- 'label': 'SMTP server',
- },
- { 'name': 'smtp_port',
- 'label': 'SMTP server port',
- 'default': '25',
- 'type': 'int',
- },
- {
- 'name': 'ssl',
- 'label': 'Enable SSL',
- 'default': 0,
- 'type': 'bool',
- },
- {
- 'name': 'starttls',
- 'label': 'Enable StartTLS',
- 'default': 0,
- 'type': 'bool',
- },
- {
- 'name': 'smtp_user',
- 'label': 'SMTP user',
- },
- {
- 'name': 'smtp_pass',
- 'label': 'SMTP password',
- 'type': 'password',
- },
- {
- 'name': 'on_snatch',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Also send message when movie is snatched.',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/growl/main.py b/couchpotato/core/notifications/growl.py
similarity index 62%
rename from couchpotato/core/notifications/growl/main.py
rename to couchpotato/core/notifications/growl.py
index a3927ed..8d67efc 100644
--- a/couchpotato/core/notifications/growl/main.py
+++ b/couchpotato/core/notifications/growl.py
@@ -64,3 +64,44 @@ class Growl(Notification):
return False
+
+config = [{
+ 'name': 'growl',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'growl',
+ 'description': 'Version 1.4+',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'on_snatch',
+ 'default': False,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Also send message when movie is snatched.',
+ },
+ {
+ 'name': 'hostname',
+ 'description': 'Notify growl over network. Needs restart.',
+ 'advanced': True,
+ },
+ {
+ 'name': 'port',
+ 'type': 'int',
+ 'advanced': True,
+ },
+ {
+ 'name': 'password',
+ 'type': 'password',
+ 'advanced': True,
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/growl/__init__.py b/couchpotato/core/notifications/growl/__init__.py
deleted file mode 100644
index dd01cb9..0000000
--- a/couchpotato/core/notifications/growl/__init__.py
+++ /dev/null
@@ -1,46 +0,0 @@
-from .main import Growl
-
-
-def start():
- return Growl()
-
-config = [{
- 'name': 'growl',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'growl',
- 'description': 'Version 1.4+',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'on_snatch',
- 'default': False,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Also send message when movie is snatched.',
- },
- {
- 'name': 'hostname',
- 'description': 'Notify growl over network. Needs restart.',
- 'advanced': True,
- },
- {
- 'name': 'port',
- 'type': 'int',
- 'advanced': True,
- },
- {
- 'name': 'password',
- 'type': 'password',
- 'advanced': True,
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/nmj/main.py b/couchpotato/core/notifications/nmj.py
similarity index 84%
rename from couchpotato/core/notifications/nmj/main.py
rename to couchpotato/core/notifications/nmj.py
index 967b70e..12bb2ad 100644
--- a/couchpotato/core/notifications/nmj/main.py
+++ b/couchpotato/core/notifications/nmj.py
@@ -118,3 +118,31 @@ class NMJ(Notification):
}
+config = [{
+ 'name': 'nmj',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'nmj',
+ 'label': 'NMJ',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'host',
+ 'default': 'localhost',
+ },
+ {
+ 'name': 'database',
+ },
+ {
+ 'name': 'mount',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/nmj/__init__.py b/couchpotato/core/notifications/nmj/__init__.py
deleted file mode 100644
index 461a450..0000000
--- a/couchpotato/core/notifications/nmj/__init__.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from .main import NMJ
-
-
-def start():
- return NMJ()
-
-config = [{
- 'name': 'nmj',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'nmj',
- 'label': 'NMJ',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'host',
- 'default': 'localhost',
- },
- {
- 'name': 'database',
- },
- {
- 'name': 'mount',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/notifymyandroid/__init__.py b/couchpotato/core/notifications/notifymyandroid.py
similarity index 54%
rename from couchpotato/core/notifications/notifymyandroid/__init__.py
rename to couchpotato/core/notifications/notifymyandroid.py
index 7d4f4ae..8b08360 100644
--- a/couchpotato/core/notifications/notifymyandroid/__init__.py
+++ b/couchpotato/core/notifications/notifymyandroid.py
@@ -1,8 +1,39 @@
-from .main import NotifyMyAndroid
+from couchpotato.core.helpers.variable import splitString
+from couchpotato.core.logger import CPLog
+from couchpotato.core.notifications.base import Notification
+import pynma
+import six
+log = CPLog(__name__)
+
+
+class NotifyMyAndroid(Notification):
+
+ def notify(self, message = '', data = None, listener = None):
+ if not data: data = {}
+
+ nma = pynma.PyNMA()
+ keys = splitString(self.conf('api_key'))
+ nma.addkey(keys)
+ nma.developerkey(self.conf('dev_key'))
+
+ response = nma.push(
+ application = self.default_title,
+ event = message.split(' ')[0],
+ description = message,
+ priority = self.conf('priority'),
+ batch_mode = len(keys) > 1
+ )
+
+ successful = 0
+ for key in keys:
+ if not response[str(key)]['code'] == six.u('200'):
+ log.error('Could not send notification to NotifyMyAndroid (%s). %s', (key, response[key]['message']))
+ else:
+ successful += 1
+
+ return successful == len(keys)
-def start():
- return NotifyMyAndroid()
config = [{
'name': 'notifymyandroid',
diff --git a/couchpotato/core/notifications/notifymyandroid/main.py b/couchpotato/core/notifications/notifymyandroid/main.py
deleted file mode 100644
index 1646510..0000000
--- a/couchpotato/core/notifications/notifymyandroid/main.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from couchpotato.core.helpers.variable import splitString
-from couchpotato.core.logger import CPLog
-from couchpotato.core.notifications.base import Notification
-import pynma
-import six
-
-log = CPLog(__name__)
-
-
-class NotifyMyAndroid(Notification):
-
- def notify(self, message = '', data = None, listener = None):
- if not data: data = {}
-
- nma = pynma.PyNMA()
- keys = splitString(self.conf('api_key'))
- nma.addkey(keys)
- nma.developerkey(self.conf('dev_key'))
-
- response = nma.push(
- application = self.default_title,
- event = message.split(' ')[0],
- description = message,
- priority = self.conf('priority'),
- batch_mode = len(keys) > 1
- )
-
- successful = 0
- for key in keys:
- if not response[str(key)]['code'] == six.u('200'):
- log.error('Could not send notification to NotifyMyAndroid (%s). %s', (key, response[key]['message']))
- else:
- successful += 1
-
- return successful == len(keys)
diff --git a/couchpotato/core/notifications/notifymywp/__init__.py b/couchpotato/core/notifications/notifymywp.py
similarity index 58%
rename from couchpotato/core/notifications/notifymywp/__init__.py
rename to couchpotato/core/notifications/notifymywp.py
index 4fcf1a9..914897f 100644
--- a/couchpotato/core/notifications/notifymywp/__init__.py
+++ b/couchpotato/core/notifications/notifymywp.py
@@ -1,8 +1,29 @@
-from .main import NotifyMyWP
+from couchpotato.core.helpers.variable import splitString
+from couchpotato.core.logger import CPLog
+from couchpotato.core.notifications.base import Notification
+from pynmwp import PyNMWP
+import six
+log = CPLog(__name__)
+
+
+class NotifyMyWP(Notification):
+
+ def notify(self, message = '', data = None, listener = None):
+ if not data: data = {}
+
+ keys = splitString(self.conf('api_key'))
+ p = PyNMWP(keys, self.conf('dev_key'))
+
+ response = p.push(application = self.default_title, event = message, description = message, priority = self.conf('priority'), batch_mode = len(keys) > 1)
+
+ for key in keys:
+ if not response[key]['Code'] == six.u('200'):
+ log.error('Could not send notification to NotifyMyWindowsPhone (%s). %s', (key, response[key]['message']))
+ return False
+
+ return response
-def start():
- return NotifyMyWP()
config = [{
'name': 'notifymywp',
diff --git a/couchpotato/core/notifications/notifymywp/main.py b/couchpotato/core/notifications/notifymywp/main.py
deleted file mode 100644
index 7401044..0000000
--- a/couchpotato/core/notifications/notifymywp/main.py
+++ /dev/null
@@ -1,25 +0,0 @@
-from couchpotato.core.helpers.variable import splitString
-from couchpotato.core.logger import CPLog
-from couchpotato.core.notifications.base import Notification
-from pynmwp import PyNMWP
-import six
-
-log = CPLog(__name__)
-
-
-class NotifyMyWP(Notification):
-
- def notify(self, message = '', data = None, listener = None):
- if not data: data = {}
-
- keys = splitString(self.conf('api_key'))
- p = PyNMWP(keys, self.conf('dev_key'))
-
- response = p.push(application = self.default_title, event = message, description = message, priority = self.conf('priority'), batch_mode = len(keys) > 1)
-
- for key in keys:
- if not response[key]['Code'] == six.u('200'):
- log.error('Could not send notification to NotifyMyWindowsPhone (%s). %s', (key, response[key]['message']))
- return False
-
- return response
diff --git a/couchpotato/core/notifications/plex/__init__.py b/couchpotato/core/notifications/plex/__init__.py
index 0de92ca..4a64ec5 100755
--- a/couchpotato/core/notifications/plex/__init__.py
+++ b/couchpotato/core/notifications/plex/__init__.py
@@ -1,7 +1,7 @@
from .main import Plex
-def start():
+def autoload():
return Plex()
config = [{
diff --git a/couchpotato/core/notifications/prowl/__init__.py b/couchpotato/core/notifications/prowl.py
similarity index 50%
rename from couchpotato/core/notifications/prowl/__init__.py
rename to couchpotato/core/notifications/prowl.py
index 3721a0a..ecadb7f 100644
--- a/couchpotato/core/notifications/prowl/__init__.py
+++ b/couchpotato/core/notifications/prowl.py
@@ -1,8 +1,39 @@
-from .main import Prowl
+from couchpotato.core.helpers.encoding import toUnicode
+from couchpotato.core.logger import CPLog
+from couchpotato.core.notifications.base import Notification
+import traceback
+log = CPLog(__name__)
+
+
+class Prowl(Notification):
+
+ urls = {
+ 'api': 'https://api.prowlapp.com/publicapi/add'
+ }
+
+ def notify(self, message = '', data = None, listener = None):
+ if not data: data = {}
+
+ data = {
+ 'apikey': self.conf('api_key'),
+ 'application': self.default_title,
+ 'description': toUnicode(message),
+ 'priority': self.conf('priority'),
+ }
+ headers = {
+ 'Content-type': 'application/x-www-form-urlencoded'
+ }
+
+ try:
+ self.urlopen(self.urls['api'], headers = headers, data = data, show_error = False)
+ log.info('Prowl notifications sent.')
+ return True
+ except:
+ log.error('Prowl failed: %s', traceback.format_exc())
+
+ return False
-def start():
- return Prowl()
config = [{
'name': 'prowl',
diff --git a/couchpotato/core/notifications/prowl/main.py b/couchpotato/core/notifications/prowl/main.py
deleted file mode 100644
index b338586..0000000
--- a/couchpotato/core/notifications/prowl/main.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from couchpotato.core.helpers.encoding import toUnicode
-from couchpotato.core.logger import CPLog
-from couchpotato.core.notifications.base import Notification
-import traceback
-
-log = CPLog(__name__)
-
-
-class Prowl(Notification):
-
- urls = {
- 'api': 'https://api.prowlapp.com/publicapi/add'
- }
-
- def notify(self, message = '', data = None, listener = None):
- if not data: data = {}
-
- data = {
- 'apikey': self.conf('api_key'),
- 'application': self.default_title,
- 'description': toUnicode(message),
- 'priority': self.conf('priority'),
- }
- headers = {
- 'Content-type': 'application/x-www-form-urlencoded'
- }
-
- try:
- self.urlopen(self.urls['api'], headers = headers, data = data, show_error = False)
- log.info('Prowl notifications sent.')
- return True
- except:
- log.error('Prowl failed: %s', traceback.format_exc())
-
- return False
diff --git a/couchpotato/core/notifications/pushalot/__init__.py b/couchpotato/core/notifications/pushalot.py
similarity index 55%
rename from couchpotato/core/notifications/pushalot/__init__.py
rename to couchpotato/core/notifications/pushalot.py
index ad0c853..9f717e4 100644
--- a/couchpotato/core/notifications/pushalot/__init__.py
+++ b/couchpotato/core/notifications/pushalot.py
@@ -1,8 +1,42 @@
-from .main import Pushalot
+from couchpotato.core.helpers.encoding import toUnicode
+from couchpotato.core.logger import CPLog
+from couchpotato.core.notifications.base import Notification
+import traceback
+log = CPLog(__name__)
+
+
+class Pushalot(Notification):
+
+ urls = {
+ 'api': 'https://pushalot.com/api/sendmessage'
+ }
+
+ def notify(self, message = '', data = None, listener = None):
+ if not data: data = {}
+
+ data = {
+ 'AuthorizationToken': self.conf('auth_token'),
+ 'Title': self.default_title,
+ 'Body': toUnicode(message),
+ 'IsImportant': self.conf('important'),
+ 'IsSilent': self.conf('silent'),
+ 'Image': toUnicode(self.getNotificationImage('medium') + '?1'),
+ 'Source': toUnicode(self.default_title)
+ }
+
+ headers = {
+ 'Content-type': 'application/x-www-form-urlencoded'
+ }
+
+ try:
+ self.urlopen(self.urls['api'], headers = headers, data = data, show_error = False)
+ return True
+ except:
+ log.error('PushAlot failed: %s', traceback.format_exc())
+
+ return False
-def start():
- return Pushalot()
config = [{
'name': 'pushalot',
diff --git a/couchpotato/core/notifications/pushalot/main.py b/couchpotato/core/notifications/pushalot/main.py
deleted file mode 100644
index 306ee1d..0000000
--- a/couchpotato/core/notifications/pushalot/main.py
+++ /dev/null
@@ -1,38 +0,0 @@
-from couchpotato.core.helpers.encoding import toUnicode
-from couchpotato.core.logger import CPLog
-from couchpotato.core.notifications.base import Notification
-import traceback
-
-log = CPLog(__name__)
-
-
-class Pushalot(Notification):
-
- urls = {
- 'api': 'https://pushalot.com/api/sendmessage'
- }
-
- def notify(self, message = '', data = None, listener = None):
- if not data: data = {}
-
- data = {
- 'AuthorizationToken': self.conf('auth_token'),
- 'Title': self.default_title,
- 'Body': toUnicode(message),
- 'IsImportant': self.conf('important'),
- 'IsSilent': self.conf('silent'),
- 'Image': toUnicode(self.getNotificationImage('medium') + '?1'),
- 'Source': toUnicode(self.default_title)
- }
-
- headers = {
- 'Content-type': 'application/x-www-form-urlencoded'
- }
-
- try:
- self.urlopen(self.urls['api'], headers = headers, data = data, show_error = False)
- return True
- except:
- log.error('PushAlot failed: %s', traceback.format_exc())
-
- return False
diff --git a/couchpotato/core/notifications/pushbullet/main.py b/couchpotato/core/notifications/pushbullet.py
similarity index 66%
rename from couchpotato/core/notifications/pushbullet/main.py
rename to couchpotato/core/notifications/pushbullet.py
index 487fb3a..beda0b3 100644
--- a/couchpotato/core/notifications/pushbullet/main.py
+++ b/couchpotato/core/notifications/pushbullet.py
@@ -67,3 +67,39 @@ class Pushbullet(Notification):
log.debug(ex)
return None
+
+
+config = [{
+ 'name': 'pushbullet',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'pushbullet',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'api_key',
+ 'label': 'User API Key'
+ },
+ {
+ 'name': 'devices',
+ 'default': '',
+ 'advanced': True,
+ 'description': 'IDs of devices to send notifications to, empty = all devices'
+ },
+ {
+ 'name': 'on_snatch',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Also send message when movie is snatched.',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/pushbullet/__init__.py b/couchpotato/core/notifications/pushbullet/__init__.py
deleted file mode 100644
index c52e778..0000000
--- a/couchpotato/core/notifications/pushbullet/__init__.py
+++ /dev/null
@@ -1,40 +0,0 @@
-from .main import Pushbullet
-
-
-def start():
- return Pushbullet()
-
-config = [{
- 'name': 'pushbullet',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'pushbullet',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'api_key',
- 'label': 'User API Key'
- },
- {
- 'name': 'devices',
- 'default': '',
- 'advanced': True,
- 'description': 'IDs of devices to send notifications to, empty = all devices'
- },
- {
- 'name': 'on_snatch',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Also send message when movie is snatched.',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/pushover/main.py b/couchpotato/core/notifications/pushover.py
similarity index 60%
rename from couchpotato/core/notifications/pushover/main.py
rename to couchpotato/core/notifications/pushover.py
index b90c211..c5e5257 100644
--- a/couchpotato/core/notifications/pushover/main.py
+++ b/couchpotato/core/notifications/pushover.py
@@ -6,6 +6,8 @@ from httplib import HTTPSConnection
log = CPLog(__name__)
+autoload = 'Pushover'
+
class Pushover(Notification):
@@ -47,3 +49,39 @@ class Pushover(Notification):
else:
log.error('Pushover notification failed.')
return False
+
+
+config = [{
+ 'name': 'pushover',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'pushover',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'user_key',
+ 'description': 'Register on pushover.net to get one.'
+ },
+ {
+ 'name': 'priority',
+ 'default': 0,
+ 'type': 'dropdown',
+ 'values': [('Normal', 0), ('High', 1)],
+ },
+ {
+ 'name': 'on_snatch',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Also send message when movie is snatched.',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/pushover/__init__.py b/couchpotato/core/notifications/pushover/__init__.py
deleted file mode 100644
index da76486..0000000
--- a/couchpotato/core/notifications/pushover/__init__.py
+++ /dev/null
@@ -1,40 +0,0 @@
-from .main import Pushover
-
-
-def start():
- return Pushover()
-
-config = [{
- 'name': 'pushover',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'pushover',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'user_key',
- 'description': 'Register on pushover.net to get one.'
- },
- {
- 'name': 'priority',
- 'default': 0,
- 'type': 'dropdown',
- 'values': [('Normal', 0), ('High', 1)],
- },
- {
- 'name': 'on_snatch',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Also send message when movie is snatched.',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/synoindex/main.py b/couchpotato/core/notifications/synoindex.py
similarity index 69%
rename from couchpotato/core/notifications/synoindex/main.py
rename to couchpotato/core/notifications/synoindex.py
index ec7a64e..7fd2084 100644
--- a/couchpotato/core/notifications/synoindex/main.py
+++ b/couchpotato/core/notifications/synoindex.py
@@ -6,6 +6,8 @@ import subprocess
log = CPLog(__name__)
+autoload = 'Synoindex'
+
class Synoindex(Notification):
@@ -35,3 +37,23 @@ class Synoindex(Notification):
return {
'success': os.path.isfile(self.index_path)
}
+
+
+config = [{
+ 'name': 'synoindex',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'synoindex',
+ 'description': 'Automaticly adds index to Synology Media Server.',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ }
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/synoindex/__init__.py b/couchpotato/core/notifications/synoindex/__init__.py
deleted file mode 100644
index 89d07b0..0000000
--- a/couchpotato/core/notifications/synoindex/__init__.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from .main import Synoindex
-
-
-def start():
- return Synoindex()
-
-config = [{
- 'name': 'synoindex',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'synoindex',
- 'description': 'Automaticly adds index to Synology Media Server.',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- }
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/toasty/main.py b/couchpotato/core/notifications/toasty.py
similarity index 54%
rename from couchpotato/core/notifications/toasty/main.py
rename to couchpotato/core/notifications/toasty.py
index ea1f219..d0bbe8a 100644
--- a/couchpotato/core/notifications/toasty/main.py
+++ b/couchpotato/core/notifications/toasty.py
@@ -5,6 +5,8 @@ import traceback
log = CPLog(__name__)
+autoload = 'Toasty'
+
class Toasty(Notification):
@@ -29,3 +31,33 @@ class Toasty(Notification):
log.error('Toasty failed: %s', traceback.format_exc())
return False
+
+
+config = [{
+ 'name': 'toasty',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'toasty',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'api_key',
+ 'label': 'Device ID',
+ },
+ {
+ 'name': 'on_snatch',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Also send message when movie is snatched.',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/toasty/__init__.py b/couchpotato/core/notifications/toasty/__init__.py
deleted file mode 100644
index 31e055a..0000000
--- a/couchpotato/core/notifications/toasty/__init__.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from .main import Toasty
-
-
-def start():
- return Toasty()
-
-config = [{
- 'name': 'toasty',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'toasty',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'api_key',
- 'label': 'Device ID',
- },
- {
- 'name': 'on_snatch',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Also send message when movie is snatched.',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/trakt/main.py b/couchpotato/core/notifications/trakt.py
similarity index 70%
rename from couchpotato/core/notifications/trakt/main.py
rename to couchpotato/core/notifications/trakt.py
index 760f9b6..8f35dea 100644
--- a/couchpotato/core/notifications/trakt/main.py
+++ b/couchpotato/core/notifications/trakt.py
@@ -4,6 +4,8 @@ from couchpotato.core.notifications.base import Notification
log = CPLog(__name__)
+autoload = 'Trakt'
+
class Trakt(Notification):
@@ -62,3 +64,30 @@ class Trakt(Notification):
log.error('Failed to call trakt, check your login.')
return False
+
+
+config = [{
+ 'name': 'trakt',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'trakt',
+ 'label': 'Trakt',
+ 'description': 'add movies to your collection once downloaded. Fill in your username and password in the Automation Trakt settings',
+ 'options': [
+ {
+ 'name': 'notification_enabled',
+ 'default': False,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'remove_watchlist_enabled',
+ 'label': 'Remove from watchlist',
+ 'default': False,
+ 'type': 'bool',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/trakt/__init__.py b/couchpotato/core/notifications/trakt/__init__.py
deleted file mode 100644
index 20e2e3f..0000000
--- a/couchpotato/core/notifications/trakt/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from .main import Trakt
-
-
-def start():
- return Trakt()
-
-config = [{
- 'name': 'trakt',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'trakt',
- 'label': 'Trakt',
- 'description': 'add movies to your collection once downloaded. Fill in your username and password in the Automation Trakt settings',
- 'options': [
- {
- 'name': 'notification_enabled',
- 'default': False,
- 'type': 'enabler',
- },
- {
- 'name': 'remove_watchlist_enabled',
- 'label': 'Remove from watchlist',
- 'default': False,
- 'type': 'bool',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/twitter/__init__.py b/couchpotato/core/notifications/twitter/__init__.py
index 1b9c769..b6b42bb 100644
--- a/couchpotato/core/notifications/twitter/__init__.py
+++ b/couchpotato/core/notifications/twitter/__init__.py
@@ -1,7 +1,7 @@
from .main import Twitter
-def start():
+def autoload():
return Twitter()
config = [{
diff --git a/couchpotato/core/notifications/xbmc/main.py b/couchpotato/core/notifications/xbmc.py
old mode 100755
new mode 100644
similarity index 79%
rename from couchpotato/core/notifications/xbmc/main.py
rename to couchpotato/core/notifications/xbmc.py
index 44e3573..48c5c9b
--- a/couchpotato/core/notifications/xbmc/main.py
+++ b/couchpotato/core/notifications/xbmc.py
@@ -11,6 +11,8 @@ from requests.packages.urllib3.exceptions import MaxRetryError
log = CPLog(__name__)
+autoload = 'XBMC'
+
class XBMC(Notification):
@@ -210,3 +212,66 @@ class XBMC(Notification):
log.error('Failed sending request to XBMC: %s', traceback.format_exc())
return []
+
+config = [{
+ 'name': 'xbmc',
+ 'groups': [
+ {
+ 'tab': 'notifications',
+ 'list': 'notification_providers',
+ 'name': 'xbmc',
+ 'label': 'XBMC',
+ 'description': 'v11 (Eden) and v12 (Frodo)',
+ 'options': [
+ {
+ 'name': 'enabled',
+ 'default': 0,
+ 'type': 'enabler',
+ },
+ {
+ 'name': 'host',
+ 'default': 'localhost:8080',
+ },
+ {
+ 'name': 'username',
+ 'default': 'xbmc',
+ },
+ {
+ 'name': 'password',
+ 'default': '',
+ 'type': 'password',
+ },
+ {
+ 'name': 'only_first',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Only update the first host when movie snatched, useful for synced XBMC',
+ },
+ {
+ 'name': 'remote_dir_scan',
+ 'label': 'Remote Folder Scan',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Only scan new movie folder at remote XBMC servers. Works if movie location is the same.',
+ },
+ {
+ 'name': 'force_full_scan',
+ 'label': 'Always do a full scan',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Do a full scan instead of only the new movie. Useful if the XBMC path is different from the path CPS uses.',
+ },
+ {
+ 'name': 'on_snatch',
+ 'default': 0,
+ 'type': 'bool',
+ 'advanced': True,
+ 'description': 'Also send message when movie is snatched.',
+ },
+ ],
+ }
+ ],
+}]
diff --git a/couchpotato/core/notifications/xbmc/__init__.py b/couchpotato/core/notifications/xbmc/__init__.py
deleted file mode 100644
index 34fed63..0000000
--- a/couchpotato/core/notifications/xbmc/__init__.py
+++ /dev/null
@@ -1,68 +0,0 @@
-from .main import XBMC
-
-
-def start():
- return XBMC()
-
-config = [{
- 'name': 'xbmc',
- 'groups': [
- {
- 'tab': 'notifications',
- 'list': 'notification_providers',
- 'name': 'xbmc',
- 'label': 'XBMC',
- 'description': 'v11 (Eden) and v12 (Frodo)',
- 'options': [
- {
- 'name': 'enabled',
- 'default': 0,
- 'type': 'enabler',
- },
- {
- 'name': 'host',
- 'default': 'localhost:8080',
- },
- {
- 'name': 'username',
- 'default': 'xbmc',
- },
- {
- 'name': 'password',
- 'default': '',
- 'type': 'password',
- },
- {
- 'name': 'only_first',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Only update the first host when movie snatched, useful for synced XBMC',
- },
- {
- 'name': 'remote_dir_scan',
- 'label': 'Remote Folder Scan',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Only scan new movie folder at remote XBMC servers. Works if movie location is the same.',
- },
- {
- 'name': 'force_full_scan',
- 'label': 'Always do a full scan',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Do a full scan instead of only the new movie. Useful if the XBMC path is different from the path CPS uses.',
- },
- {
- 'name': 'on_snatch',
- 'default': 0,
- 'type': 'bool',
- 'advanced': True,
- 'description': 'Also send message when movie is snatched.',
- },
- ],
- }
- ],
-}]
diff --git a/couchpotato/core/notifications/xmpp/__init__.py b/couchpotato/core/notifications/xmpp.py
similarity index 52%
rename from couchpotato/core/notifications/xmpp/__init__.py
rename to couchpotato/core/notifications/xmpp.py
index 0e3e14d..6a978e5 100644
--- a/couchpotato/core/notifications/xmpp/__init__.py
+++ b/couchpotato/core/notifications/xmpp.py
@@ -1,8 +1,49 @@
-from .main import Xmpp
+from couchpotato.core.logger import CPLog
+from couchpotato.core.notifications.base import Notification
+from time import sleep
+import traceback
+import xmpp
+log = CPLog(__name__)
+
+autoload = 'Xmpp'
+
+
+class Xmpp(Notification):
+
+ def notify(self, message = '', data = None, listener = None):
+ if not data: data = {}
+
+ try:
+ jid = xmpp.protocol.JID(self.conf('username'))
+ client = xmpp.Client(jid.getDomain(), debug = [])
+
+ # Connect
+ if not client.connect(server = (self.conf('hostname'), self.conf('port'))):
+ log.error('XMPP failed: Connection to server failed.')
+ return False
+
+ # Authenticate
+ if not client.auth(jid.getNode(), self.conf('password'), resource = jid.getResource()):
+ log.error('XMPP failed: Failed to authenticate.')
+ return False
+
+ # Send message
+ client.send(xmpp.protocol.Message(to = self.conf('to'), body = message, typ = 'chat'))
+
+ # Disconnect
+ # some older servers will not send the message if you disconnect immediately after sending
+ sleep(1)
+ client.disconnect()
+
+ log.info('XMPP notifications sent.')
+ return True
+
+ except:
+ log.error('XMPP failed: %s', traceback.format_exc())
+
+ return False
-def start():
- return Xmpp()
config = [{
'name': 'xmpp',
diff --git a/couchpotato/core/notifications/xmpp/main.py b/couchpotato/core/notifications/xmpp/main.py
deleted file mode 100644
index 0011e41..0000000
--- a/couchpotato/core/notifications/xmpp/main.py
+++ /dev/null
@@ -1,43 +0,0 @@
-from couchpotato.core.logger import CPLog
-from couchpotato.core.notifications.base import Notification
-from time import sleep
-import traceback
-import xmpp
-
-log = CPLog(__name__)
-
-
-class Xmpp(Notification):
-
- def notify(self, message = '', data = None, listener = None):
- if not data: data = {}
-
- try:
- jid = xmpp.protocol.JID(self.conf('username'))
- client = xmpp.Client(jid.getDomain(), debug = [])
-
- # Connect
- if not client.connect(server = (self.conf('hostname'), self.conf('port'))):
- log.error('XMPP failed: Connection to server failed.')
- return False
-
- # Authenticate
- if not client.auth(jid.getNode(), self.conf('password'), resource = jid.getResource()):
- log.error('XMPP failed: Failed to authenticate.')
- return False
-
- # Send message
- client.send(xmpp.protocol.Message(to = self.conf('to'), body = message, typ = 'chat'))
-
- # Disconnect
- # some older servers will not send the message if you disconnect immediately after sending
- sleep(1)
- client.disconnect()
-
- log.info('XMPP notifications sent.')
- return True
-
- except:
- log.error('XMPP failed: %s', traceback.format_exc())
-
- return False