1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Notify on update for notifiers via email has been disabled for now till we re-write the email notification code better, fixed a few small errors here and there.

This commit is contained in:
echel0n 2014-07-03 14:04:26 -07:00
parent 20456fde6b
commit c34442f5c1
22 changed files with 69 additions and 94 deletions

View File

@ -50,15 +50,15 @@ SEASON_RESULT = -2
NOTIFY_SNATCH = 1
NOTIFY_DOWNLOAD = 2
NOTIFY_SUBTITLE_DOWNLOAD = 3
NOTIFY_SICKRAGE_UPDATE = 4
NOTIFY_SICKRAGE_UPDATE_TEXT = 5
NOTIFY_GIT_UPDATE = 4
NOTIFY_GIT_UPDATE_TEXT = 5
notifyStrings = {}
notifyStrings[NOTIFY_SNATCH] = "Started Download"
notifyStrings[NOTIFY_DOWNLOAD] = "Download Finished"
notifyStrings[NOTIFY_SUBTITLE_DOWNLOAD] = "Subtitle Download Finished"
notifyStrings[NOTIFY_SICKRAGE_UPDATE] = "SickRage Updated"
notifyStrings[NOTIFY_SICKRAGE_UPDATE_TEXT] = "SickRage updated to version: "
notifyStrings[NOTIFY_GIT_UPDATE] = "SickRage Updated"
notifyStrings[NOTIFY_GIT_UPDATE_TEXT] = "SickRage Updated To Commit#: "
### Episode statuses
UNKNOWN = -1 # should never happen

View File

@ -102,7 +102,6 @@ def notify_snatch(ep_name):
for n in notifiers:
n.notify_snatch(ep_name)
def notify_sickrage_update(new_version = ""):
if sickbeard.NOTIFY_ON_UPDATE:
for n in notifiers:
n.notify_sickrage_update(new_version)
def notify_git_update(new_version = ""):
for n in notifiers:
n.notify_git_update(new_version)

View File

@ -23,7 +23,7 @@ import time
import sickbeard
from sickbeard import logger
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_SICKRAGE_UPDATE, NOTIFY_SICKRAGE_UPDATE_TEXT
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_GIT_UPDATE, NOTIFY_GIT_UPDATE_TEXT
from sickbeard.exceptions import ex
API_URL = "https://boxcar.io/devices/providers/fWc4sgSmpcN6JujtBmR6/notifications"
@ -123,10 +123,10 @@ class BoxcarNotifier:
if sickbeard.BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notifyBoxcar(title, ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_BOXCAR:
update_text=notifyStrings[NOTIFY_SICKRAGE_UPDATE_TEXT]
title=notifyStrings[NOTIFY_SICKRAGE_UPDATE]
update_text=notifyStrings[NOTIFY_GIT_UPDATE_TEXT]
title=notifyStrings[NOTIFY_GIT_UPDATE]
self._notifyBoxcar(title, update_text + new_version)
def _notifyBoxcar(self, title, message, username=None, force=False):

View File

@ -24,7 +24,7 @@ import time
import sickbeard
from sickbeard import logger
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_SICKRAGE_UPDATE, NOTIFY_SICKRAGE_UPDATE_TEXT
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_GIT_UPDATE, NOTIFY_GIT_UPDATE_TEXT
from sickbeard.exceptions import ex
API_URL = "https://new.boxcar.io/api/notifications"
@ -97,10 +97,10 @@ class Boxcar2Notifier:
if sickbeard.BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notifyBoxcar2(title, ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_BOXCAR2:
update_text=notifyStrings[NOTIFY_SICKRAGE_UPDATE_TEXT]
title=notifyStrings[NOTIFY_SICKRAGE_UPDATE]
update_text=notifyStrings[NOTIFY_GIT_UPDATE_TEXT]
title=notifyStrings[NOTIFY_GIT_UPDATE]
self._notifyBoxcar2(title, update_text + new_version)
def _notifyBoxcar2(self, title, message, accesstoken=None):

View File

@ -14,7 +14,7 @@
# SickRage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
@ -141,37 +141,10 @@ class EmailNotifier:
logger.log("Download notification sent to [%s] for '%s'" % (to, ep_name), logger.DEBUG)
else:
logger.log("Download notification ERROR: %s" % self.last_err, logger.ERROR)
def notify_sickrage_update(self, new_version = "??"):
"""
Send a notification that an updated version of SickRage has been installed
"""
if sickbeard.USE_EMAIL:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
to = self._generate_recepients(show)
if len(to) == 0:
logger.log('Skipping email notify because there are no configured recepients', logger.WARNING)
else:
try:
msg = MIMEMultipart('alternative')
msg.attach(MIMEText(
"<body style='font-family:Helvetica, Arial, sans-serif;'><h3>SickRage Notification - " + title + "</h3>\n<p>" + update_text + new_version + "</p>\n\n<footer style='margin-top: 2.5em; padding: .7em 0; color: #777; border-top: #BBB solid 1px;'>Powered by SickRage.</footer></body>",
'html'))
except:
logger.log("SickRage update notification ERROR: %s" % self.last_err, logger.ERROR)
msg['Subject'] = lang + ' Subtitle Downloaded: ' + ep_name
msg['From'] = sickbeard.EMAIL_FROM
msg['To'] = ','.join(to)
if self._sendmail(sickbeard.EMAIL_HOST, sickbeard.EMAIL_PORT, sickbeard.EMAIL_FROM, sickbeard.EMAIL_TLS,
sickbeard.EMAIL_USER, sickbeard.EMAIL_PASSWORD, to, msg):
logger.log("Download notification sent to [%s] for '%s'" % (to, ep_name), logger.DEBUG)
else:
logger.log("Download notification ERROR: %s" % self.last_err, logger.ERROR)
def notify_git_update(self, new_version="??"):
pass
def _generate_recepients(self, show):
addrs = []
@ -196,7 +169,7 @@ class EmailNotifier:
def _sendmail(self, host, port, smtp_from, use_tls, user, pwd, to, msg, smtpDebug=False):
logger.log('HOST: %s; PORT: %s; FROM: %s, TLS: %s, USER: %s, PWD: %s, TO: %s' % (
host, port, smtp_from, use_tls, user, pwd, to), logger.DEBUG)
host, port, smtp_from, use_tls, user, pwd, to), logger.DEBUG)
srv = smtplib.SMTP(host, int(port))
if smtpDebug:
srv.set_debuglevel(1)

View File

@ -44,10 +44,10 @@ class GrowlNotifier:
if sickbeard.GROWL_NOTIFY_ONSUBTITLEDOWNLOAD:
self._sendGrowl(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD], ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_GROWL:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._sendGrowl(title, update_text + new_version)
def _send_growl(self, options, message=None):

View File

@ -93,9 +93,9 @@ class LibnotifyNotifier:
if sickbeard.LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notify(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD], ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_LIBNOTIFY:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT], title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT], title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._notify(title, update_text + new_version)
def test_notify(self):

View File

@ -24,10 +24,10 @@ class NMA_Notifier:
self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD],
message=ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_NMA:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text + new_version)
def _sendNMA(self, nma_api=None, nma_priority=None, event=None, message=None, force=False):

View File

@ -97,7 +97,7 @@ class NMJNotifier:
if sickbeard.USE_NMJ:
self._notifyNMJ()
def notify_sickrage_update(self, new_version):
def notify_git_update(self, new_version):
return False
# Not implemented, no reason to start scanner.

View File

@ -43,7 +43,7 @@ class NMJv2Notifier:
def notify_subtitle_download(self, ep_name, lang):
self._notifyNMJ()
def notify_sickrage_update(self, new_version):
def notify_git_update(self, new_version):
return False
# Not implemented, no reason to start scanner.

View File

@ -11,7 +11,7 @@
# SickRage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
@ -35,10 +35,10 @@ from xml.dom import minidom
class PLEXNotifier(XBMCNotifier):
def _notify_pmc(self, message, title="SickRage", host=None, username=None, password=None, force=False):
# fill in omitted parameters
# fill in omitted parameters
if not host:
if sickbeard.PLEX_HOST:
host = sickbeard.PLEX_HOST # Use the default Plex host
host = sickbeard.PLEX_HOST # Use the default Plex host
else:
logger.log(u"No Plex host specified, check your settings", logger.DEBUG)
return False
@ -52,7 +52,8 @@ class PLEXNotifier(XBMCNotifier):
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)
return self._notify_xbmc(message=message, title=title, host=host, username=username, password=password,
force=True)
def notify_snatch(self, ep_name):
if sickbeard.PLEX_NOTIFY_ONSNATCH:
@ -65,11 +66,11 @@ class PLEXNotifier(XBMCNotifier):
def notify_subtitle_download(self, ep_name, lang):
if sickbeard.PLEX_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notify_pmc(ep_name + ": " + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD])
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version="??"):
if sickbeard.USE_PLEX:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text = common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title = common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._notify_pmc(update_text + new_version, title)
def test_notify(self, host, username, password):
@ -117,4 +118,5 @@ class PLEXNotifier(XBMCNotifier):
return True
notifier = PLEXNotifier

View File

@ -52,10 +52,10 @@ class ProwlNotifier:
self._sendProwl(prowl_api=None, prowl_priority=None,
event=common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD], message=ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_PROWL:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._sendProwl(prowl_api=None, prowl_priority=None,
event=title, message=update_text + new_version)

View File

@ -46,10 +46,10 @@ class PushalotNotifier:
event=common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD],
message=ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_PUSHALOT:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._sendPushalot(pushalot_authorizationtoken=None,
event=title,
message=update_text + new_version)

View File

@ -49,10 +49,10 @@ class PushbulletNotifier:
self._sendPushbullet(pushbullet_api=None, event=common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD] + " : " + ep_name + " : " + lang,
message=ep_name + ": " + lang, notificationType="note", method="POST")
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_PUSHBULLET:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._sendPushbullet(pushbullet_api=None, event=title, message=update_text + new_version, method="POST")
def _sendPushbullet(self, pushbullet_api=None, pushbullet_device=None, event=None, message=None,

View File

@ -23,7 +23,7 @@ import time
import sickbeard
from sickbeard import logger
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_SICKRAGE_UPDATE, NOTIFY_SICKRAGE_UPDATE_TEXT
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_GIT_UPDATE, NOTIFY_GIT_UPDATE_TEXT
from sickbeard.exceptions import ex
API_URL = "https://api.pushover.net/1/messages.json"
@ -120,10 +120,10 @@ class PushoverNotifier:
if sickbeard.PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notifyPushover(title, ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_PUSHOVER:
update_text=notifyStrings[NOTIFY_SICKRAGE_UPDATE_TEXT]
title=notifyStrings[NOTIFY_SICKRAGE_UPDATE]
update_text=notifyStrings[NOTIFY_GIT_UPDATE_TEXT]
title=notifyStrings[NOTIFY_GIT_UPDATE]
self._notifyPushover(title, update_text + new_version)
def _notifyPushover(self, title, message, userKey=None, apiKey=None, force=False):

View File

@ -37,7 +37,7 @@ class pyTivoNotifier:
def notify_subtitle_download(self, ep_name, lang):
pass
def notify_sickrage_update(self, new_version):
def notify_git_update(self, new_version):
pass
def update_library(self, ep_obj):

View File

@ -38,7 +38,7 @@ class synoIndexNotifier:
def notify_subtitle_download(self, ep_name, lang):
pass
def notify_sickrage_update(self, new_version):
def notify_git_update(self, new_version):
pass
def moveFolder(self, old_path, new_path):

View File

@ -41,10 +41,10 @@ class synologyNotifier:
if sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD:
self._send_synologyNotifier(ep_name + ": " + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD])
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_SYNOLOGYNOTIFIER:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._send_synologyNotifier(update_text + new_version, title)
def _send_synologyNotifier(self, message, title):

View File

@ -35,7 +35,7 @@ class TraktNotifier:
def notify_subtitle_download(self, ep_name, lang):
pass
def notify_sickrage_update(self, new_version):
def notify_git_update(self, new_version):
pass
def update_library(self, ep_obj):

View File

@ -52,10 +52,10 @@ class TwitterNotifier:
if sickbeard.TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notifyTwitter(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD] + ' ' + ep_name + ": " + lang)
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_TWITTER:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._notifyTwitter(title + " - " + update_text + new_version)
def test_notify(self):

View File

@ -513,10 +513,10 @@ class XBMCNotifier:
if sickbeard.XBMC_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notify_xbmc(ep_name + ": " + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD])
def notify_sickrage_update(self, new_version = "??"):
def notify_git_update(self, new_version = "??"):
if sickbeard.USE_XBMC:
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
self._notify_xbmc(update_text + new_version, title)
def test_notify(self, host, username, password):

View File

@ -262,7 +262,7 @@ class WindowsUpdateManager(UpdateManager):
shutil.move(old_update_path, new_update_path)
# Notify update successful
notifiers.notify_sickrage_update(sickbeard.NEWEST_VERSION_STRING)
notifiers.notify_git_update(sickbeard.NEWEST_VERSION_STRING)
except Exception, e:
logger.log(u"Error while trying to update: " + ex(e), logger.ERROR)
@ -513,7 +513,8 @@ class GitUpdateManager(UpdateManager):
if exit_status == 0:
# Notify update successful
notifiers.notify_sickrage_update(self._newest_commit_hash[:10])
if sickbeard.NOTIFY_ON_UPDATE:
notifiers.notify_git_update(self._newest_commit_hash[:10])
return True
return False
@ -720,6 +721,6 @@ class SourceUpdateManager(UpdateManager):
return False
# Notify update successful
notifiers.notify_sickrage_update(sickbeard.NEWEST_VERSION_STRING)
notifiers.notify_git_update(sickbeard.NEWEST_VERSION_STRING)
return True