1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 03:22:22 -05:00

Fix the Plex notifier

Previously, the fix would cause the Plex notifier not to work except in test mode or when the XBMC notifier was enabled. This fixes that.
This commit is contained in:
Michael Johnson 2014-05-03 23:57:34 -04:00
parent 10a17d09cb
commit 0077a8e518

View File

@ -34,20 +34,36 @@ from xml.dom import minidom
class PLEXNotifier(XBMCNotifier): class PLEXNotifier(XBMCNotifier):
def _notify_pmc(self, message, title="Sick Beard", host=None, username=None, password=None, force=False):
# fill in omitted parameters
if not host:
host = sickbeard.PLEX_HOST
if not username:
username = sickbeard.PLEX_USERNAME
if not password:
password = sickbeard.PLEX_PASSWORD
# suppress notifications if the notifier is disabled but the notify options are checked
if not sickbeard.USE_PLEX and not force:
logger.log("Notification for Plex not enabled, skipping this notification", logger.DEBUG)
return False
return self._notify_xbmc(message=message, title=title, host=host, username=username, password=password, force=True)
def notify_snatch(self, ep_name): def notify_snatch(self, ep_name):
if sickbeard.PLEX_NOTIFY_ONSNATCH: if sickbeard.PLEX_NOTIFY_ONSNATCH:
self._notify_xbmc(ep_name, common.notifyStrings[common.NOTIFY_SNATCH]) self._notify_pmc(ep_name, common.notifyStrings[common.NOTIFY_SNATCH])
def notify_download(self, ep_name): def notify_download(self, ep_name):
if sickbeard.PLEX_NOTIFY_ONDOWNLOAD: if sickbeard.PLEX_NOTIFY_ONDOWNLOAD:
self._notify_xbmc(ep_name, common.notifyStrings[common.NOTIFY_DOWNLOAD]) self._notify_pmc(ep_name, common.notifyStrings[common.NOTIFY_DOWNLOAD])
def notify_subtitle_download(self, ep_name, lang): def notify_subtitle_download(self, ep_name, lang):
if sickbeard.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD: if sickbeard.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notify_xbmc(ep_name + ": " + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD]) self._notify_pmc(ep_name + ": " + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD])
def test_notify(self, host, username, password): def test_notify(self, host, username, password):
return self._notify_xbmc("Testing Plex notifications from Sick Beard", "Test Notification", host, username, return self._notify_pmc("Testing Plex notifications from Sick Beard", "Test Notification", host, username,
password, force=True) password, force=True)
def update_library(self): def update_library(self):