mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
3fa750651c
Notifiers are now loaded into memory on demand. Add bubble links to Notifications config tabs. Add Discordapp notifier to Notifications config/Social. Add Gitter notifier to Notifications config/Social. Change order of notifiers in Notifications config tabs. Remove Pushalot notifier. Remove XBMC notifier. Refactor update_library, notify, test notify and test results functions. Change most IDs and vars consistent for HTML, CSS, JS, and Python - related to notifications, camelCase for JS, underscore separated lower_case for python, hyphen separated-lowercase for CSS. A couple of exceptions have been left untouched in this clean up. Change commented out some unused vars in preparation for later removal.
38 lines
986 B
Python
38 lines
986 B
Python
import sickbeard
|
|
from sickbeard.notifiers.generic import Notifier
|
|
|
|
from lib.pynma import pynma
|
|
|
|
|
|
class NMANotifier(Notifier):
|
|
|
|
def _notify(self, title, body, nma_api=None, nma_priority=None, **kwargs):
|
|
|
|
nma_api = self._choose(nma_api, sickbeard.NMA_API)
|
|
nma_priority = self._choose(nma_priority, sickbeard.NMA_PRIORITY)
|
|
|
|
batch = False
|
|
|
|
p = pynma.PyNMA()
|
|
keys = nma_api.split(',')
|
|
p.addkey(keys)
|
|
|
|
if 1 < len(keys):
|
|
batch = True
|
|
|
|
self._log_debug('Sending notice with priority=%s, batch=%s' % (nma_priority, batch))
|
|
response = p.push('SickGear', title, body, priority=nma_priority, batch_mode=batch)
|
|
|
|
result = False
|
|
try:
|
|
if u'200' != response[nma_api][u'code']:
|
|
self._log_error('Notification failed')
|
|
else:
|
|
result = True
|
|
except (StandardError, Exception):
|
|
pass
|
|
|
|
return result
|
|
|
|
|
|
notifier = NMANotifier
|