Clean up notifiers

This commit is contained in:
Jonathan Wong 2015-12-10 21:00:00 -08:00
parent 307230cec8
commit 1262de2ae2

View file

@ -385,9 +385,6 @@ class GROWL(object):
self.enabled = plexpy.CONFIG.GROWL_ENABLED self.enabled = plexpy.CONFIG.GROWL_ENABLED
self.host = plexpy.CONFIG.GROWL_HOST self.host = plexpy.CONFIG.GROWL_HOST
self.password = plexpy.CONFIG.GROWL_PASSWORD self.password = plexpy.CONFIG.GROWL_PASSWORD
self.on_play = plexpy.CONFIG.GROWL_ON_PLAY
self.on_stop = plexpy.CONFIG.GROWL_ON_STOP
self.on_watched = plexpy.CONFIG.GROWL_ON_WATCHED
def conf(self, options): def conf(self, options):
return cherrypy.config['config'].get('Growl', options) return cherrypy.config['config'].get('Growl', options)
@ -490,9 +487,6 @@ class PROWL(object):
self.enabled = plexpy.CONFIG.PROWL_ENABLED self.enabled = plexpy.CONFIG.PROWL_ENABLED
self.keys = plexpy.CONFIG.PROWL_KEYS self.keys = plexpy.CONFIG.PROWL_KEYS
self.priority = plexpy.CONFIG.PROWL_PRIORITY self.priority = plexpy.CONFIG.PROWL_PRIORITY
self.on_play = plexpy.CONFIG.PROWL_ON_PLAY
self.on_stop = plexpy.CONFIG.PROWL_ON_STOP
self.on_watched = plexpy.CONFIG.PROWL_ON_WATCHED
def conf(self, options): def conf(self, options):
return cherrypy.config['config'].get('Prowl', options) return cherrypy.config['config'].get('Prowl', options)
@ -565,9 +559,6 @@ class XBMC(object):
self.hosts = plexpy.CONFIG.XBMC_HOST self.hosts = plexpy.CONFIG.XBMC_HOST
self.username = plexpy.CONFIG.XBMC_USERNAME self.username = plexpy.CONFIG.XBMC_USERNAME
self.password = plexpy.CONFIG.XBMC_PASSWORD self.password = plexpy.CONFIG.XBMC_PASSWORD
self.on_play = plexpy.CONFIG.XBMC_ON_PLAY
self.on_stop = plexpy.CONFIG.XBMC_ON_STOP
self.on_watched = plexpy.CONFIG.XBMC_ON_WATCHED
def _sendhttp(self, host, command): def _sendhttp(self, host, command):
url_command = urllib.urlencode(command) url_command = urllib.urlencode(command)
@ -648,9 +639,6 @@ class Plex(object):
self.client_hosts = plexpy.CONFIG.PLEX_CLIENT_HOST self.client_hosts = plexpy.CONFIG.PLEX_CLIENT_HOST
self.username = plexpy.CONFIG.PLEX_USERNAME self.username = plexpy.CONFIG.PLEX_USERNAME
self.password = plexpy.CONFIG.PLEX_PASSWORD self.password = plexpy.CONFIG.PLEX_PASSWORD
self.on_play = plexpy.CONFIG.PLEX_ON_PLAY
self.on_stop = plexpy.CONFIG.PLEX_ON_STOP
self.on_watched = plexpy.CONFIG.PLEX_ON_WATCHED
def _sendhttp(self, host, command): def _sendhttp(self, host, command):
@ -728,9 +716,6 @@ class NMA(object):
def __init__(self): def __init__(self):
self.api = plexpy.CONFIG.NMA_APIKEY self.api = plexpy.CONFIG.NMA_APIKEY
self.nma_priority = plexpy.CONFIG.NMA_PRIORITY self.nma_priority = plexpy.CONFIG.NMA_PRIORITY
self.on_play = plexpy.CONFIG.NMA_ON_PLAY
self.on_stop = plexpy.CONFIG.NMA_ON_STOP
self.on_watched = plexpy.CONFIG.NMA_ON_WATCHED
def notify(self, subject=None, message=None): def notify(self, subject=None, message=None):
if not subject or not message: if not subject or not message:
@ -790,9 +775,6 @@ class PUSHBULLET(object):
self.apikey = plexpy.CONFIG.PUSHBULLET_APIKEY self.apikey = plexpy.CONFIG.PUSHBULLET_APIKEY
self.deviceid = plexpy.CONFIG.PUSHBULLET_DEVICEID self.deviceid = plexpy.CONFIG.PUSHBULLET_DEVICEID
self.channel_tag = plexpy.CONFIG.PUSHBULLET_CHANNEL_TAG self.channel_tag = plexpy.CONFIG.PUSHBULLET_CHANNEL_TAG
self.on_play = plexpy.CONFIG.PUSHBULLET_ON_PLAY
self.on_stop = plexpy.CONFIG.PUSHBULLET_ON_STOP
self.on_watched = plexpy.CONFIG.PUSHBULLET_ON_WATCHED
def conf(self, options): def conf(self, options):
return cherrypy.config['config'].get('PUSHBULLET', options) return cherrypy.config['config'].get('PUSHBULLET', options)
@ -869,9 +851,6 @@ class PUSHALOT(object):
def __init__(self): def __init__(self):
self.api_key = plexpy.CONFIG.PUSHALOT_APIKEY self.api_key = plexpy.CONFIG.PUSHALOT_APIKEY
self.on_play = plexpy.CONFIG.PUSHALOT_ON_PLAY
self.on_stop = plexpy.CONFIG.PUSHALOT_ON_STOP
self.on_watched = plexpy.CONFIG.PUSHALOT_ON_WATCHED
def notify(self, message, event): def notify(self, message, event):
if not message or not event: if not message or not event:
@ -928,9 +907,6 @@ class PUSHOVER(object):
self.keys = plexpy.CONFIG.PUSHOVER_KEYS self.keys = plexpy.CONFIG.PUSHOVER_KEYS
self.priority = plexpy.CONFIG.PUSHOVER_PRIORITY self.priority = plexpy.CONFIG.PUSHOVER_PRIORITY
self.sound = plexpy.CONFIG.PUSHOVER_SOUND self.sound = plexpy.CONFIG.PUSHOVER_SOUND
self.on_play = plexpy.CONFIG.PUSHOVER_ON_PLAY
self.on_stop = plexpy.CONFIG.PUSHOVER_ON_STOP
self.on_watched = plexpy.CONFIG.PUSHOVER_ON_WATCHED
if plexpy.CONFIG.PUSHOVER_APITOKEN: if plexpy.CONFIG.PUSHOVER_APITOKEN:
self.application_token = plexpy.CONFIG.PUSHOVER_APITOKEN self.application_token = plexpy.CONFIG.PUSHOVER_APITOKEN
@ -1158,9 +1134,6 @@ class TwitterNotifier(object):
class OSX_NOTIFY(object): class OSX_NOTIFY(object):
def __init__(self): def __init__(self):
self.on_play = plexpy.CONFIG.OSX_NOTIFY_ON_PLAY
self.on_stop = plexpy.CONFIG.OSX_NOTIFY_ON_STOP
self.on_watched = plexpy.CONFIG.OSX_NOTIFY_ON_WATCHED
try: try:
self.objc = __import__("objc") self.objc = __import__("objc")
self.AppKit = __import__("AppKit") self.AppKit = __import__("AppKit")
@ -1247,9 +1220,6 @@ class BOXCAR(object):
self.url = 'https://new.boxcar.io/api/notifications' self.url = 'https://new.boxcar.io/api/notifications'
self.token = plexpy.CONFIG.BOXCAR_TOKEN self.token = plexpy.CONFIG.BOXCAR_TOKEN
self.sound = plexpy.CONFIG.BOXCAR_SOUND self.sound = plexpy.CONFIG.BOXCAR_SOUND
self.on_play = plexpy.CONFIG.BOXCAR_ON_PLAY
self.on_stop = plexpy.CONFIG.BOXCAR_ON_STOP
self.on_watched = plexpy.CONFIG.BOXCAR_ON_WATCHED
def notify(self, title, message): def notify(self, title, message):
if not title or not message: if not title or not message:
@ -1322,9 +1292,7 @@ class BOXCAR(object):
class Email(object): class Email(object):
def __init__(self): def __init__(self):
self.on_play = plexpy.CONFIG.EMAIL_ON_PLAY pass
self.on_stop = plexpy.CONFIG.EMAIL_ON_STOP
self.on_watched = plexpy.CONFIG.EMAIL_ON_WATCHED
def notify(self, subject, message): def notify(self, subject, message):
if not subject or not message: if not subject or not message: