mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-16 14:25:02 -05:00
Merge pull request #624 from rawsonm88/feature/update_notifications
Notify users on SickRage update via notifiers
This commit is contained in:
commit
5edfac5451
@ -92,13 +92,20 @@
|
||||
<input type="checkbox" name="auto_update" id="auto_update" #if $sickbeard.AUTO_UPDATE then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="auto_update">
|
||||
<span class="component-title">Automatic Updates</span>
|
||||
<span class="component-desc">Automatically get and install updates for SickRage when available. These</span>
|
||||
<span class="component-desc">Automatically get and install updates for SickRage when available.</span>
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">updates run on startup and in the background on the interval specified above.</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<input type="checkbox" name="notify_on_update" id="notify_on_update" #if $sickbeard.NOTIFY_ON_UPDATE then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="notify_on_update">
|
||||
<span class="component-title">Notify on Update</span>
|
||||
<span class="component-desc">Sends the notification SickRage has been updated to all enabled notifiers.</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field-pair">
|
||||
<input type="checkbox" name="sort_article" id="sort_article" #if $sickbeard.SORT_ARTICLE then "checked=\"checked\"" else ""#/>
|
||||
|
@ -100,6 +100,7 @@ NEWEST_VERSION = None
|
||||
NEWEST_VERSION_STRING = None
|
||||
VERSION_NOTIFY = None
|
||||
AUTO_UPDATE = None
|
||||
NOTIFY_ON_UPDATE = None
|
||||
CUR_COMMIT_HASH = None
|
||||
|
||||
INIT_LOCK = Lock()
|
||||
@ -457,7 +458,7 @@ def initialize(consoleLogging=True):
|
||||
USE_NMA, NMA_NOTIFY_ONSNATCH, NMA_NOTIFY_ONDOWNLOAD, NMA_NOTIFY_ONSUBTITLEDOWNLOAD, NMA_API, NMA_PRIORITY, \
|
||||
USE_PUSHALOT, PUSHALOT_NOTIFY_ONSNATCH, PUSHALOT_NOTIFY_ONDOWNLOAD, PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHALOT_AUTHORIZATIONTOKEN, \
|
||||
USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \
|
||||
versionCheckScheduler, VERSION_NOTIFY, AUTO_UPDATE, PROCESS_AUTOMATICALLY, UNPACK, CPU_PRESET, \
|
||||
versionCheckScheduler, VERSION_NOTIFY, AUTO_UPDATE, NOTIFY_ON_UPDATE, PROCESS_AUTOMATICALLY, UNPACK, CPU_PRESET, \
|
||||
KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_DAILYSEARCH_FREQUENCY, DEFAULT_UPDATE_FREQUENCY, MIN_UPDATE_FREQUENCY, UPDATE_FREQUENCY, \
|
||||
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, TIMEZONE_DISPLAY, \
|
||||
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_SPORTS_PATTERN, NAMING_CUSTOM_SPORTS, NAMING_STRIP_YEAR, \
|
||||
@ -589,6 +590,7 @@ def initialize(consoleLogging=True):
|
||||
STATUS_DEFAULT = check_setting_int(CFG, 'General', 'status_default', SKIPPED)
|
||||
VERSION_NOTIFY = check_setting_int(CFG, 'General', 'version_notify', 1)
|
||||
AUTO_UPDATE = check_setting_int(CFG, 'General', 'auto_update', 0)
|
||||
NOTIFY_ON_UPDATE = check_setting_int(CFG, 'General', 'notify_on_update', 1)
|
||||
FLATTEN_FOLDERS_DEFAULT = bool(check_setting_int(CFG, 'General', 'flatten_folders_default', 0))
|
||||
INDEXER_DEFAULT = check_setting_int(CFG, 'General', 'indexer_default', 0)
|
||||
INDEXER_TIMEOUT = check_setting_int(CFG, 'General', 'indexer_timeout', 10)
|
||||
@ -1388,6 +1390,7 @@ def save_config():
|
||||
new_config['General']['provider_order'] = ' '.join(PROVIDER_ORDER)
|
||||
new_config['General']['version_notify'] = int(VERSION_NOTIFY)
|
||||
new_config['General']['auto_update'] = int(AUTO_UPDATE)
|
||||
new_config['General']['notify_on_update'] = int(NOTIFY_ON_UPDATE)
|
||||
new_config['General']['naming_strip_year'] = int(NAMING_STRIP_YEAR)
|
||||
new_config['General']['naming_pattern'] = NAMING_PATTERN
|
||||
new_config['General']['naming_custom_abd'] = int(NAMING_CUSTOM_ABD)
|
||||
|
@ -50,11 +50,15 @@ SEASON_RESULT = -2
|
||||
NOTIFY_SNATCH = 1
|
||||
NOTIFY_DOWNLOAD = 2
|
||||
NOTIFY_SUBTITLE_DOWNLOAD = 3
|
||||
NOTIFY_SICKRAGE_UPDATE = 4
|
||||
NOTIFY_SICKRAGE_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: "
|
||||
|
||||
### Episode statuses
|
||||
UNKNOWN = -1 # should never happen
|
||||
|
@ -101,3 +101,8 @@ def notify_subtitle_download(ep_name, lang):
|
||||
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)
|
||||
|
@ -23,7 +23,7 @@ import time
|
||||
import sickbeard
|
||||
|
||||
from sickbeard import logger
|
||||
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD
|
||||
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_SICKRAGE_UPDATE, NOTIFY_SICKRAGE_UPDATE_TEXT
|
||||
from sickbeard.exceptions import ex
|
||||
|
||||
API_URL = "https://boxcar.io/devices/providers/fWc4sgSmpcN6JujtBmR6/notifications"
|
||||
@ -122,6 +122,12 @@ class BoxcarNotifier:
|
||||
def notify_subtitle_download(self, ep_name, lang, title=notifyStrings[NOTIFY_SUBTITLE_DOWNLOAD]):
|
||||
if sickbeard.BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._notifyBoxcar(title, ep_name + ": " + lang)
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_BOXCAR:
|
||||
update_text=notifyStrings[NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=notifyStrings[NOTIFY_SICKRAGE_UPDATE]
|
||||
self._notifyBoxcar(title, update_text + new_version)
|
||||
|
||||
def _notifyBoxcar(self, title, message, username=None, force=False):
|
||||
"""
|
||||
|
@ -24,7 +24,7 @@ import time
|
||||
import sickbeard
|
||||
|
||||
from sickbeard import logger
|
||||
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD
|
||||
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_SICKRAGE_UPDATE, NOTIFY_SICKRAGE_UPDATE_TEXT
|
||||
from sickbeard.exceptions import ex
|
||||
|
||||
API_URL = "https://new.boxcar.io/api/notifications"
|
||||
@ -96,6 +96,12 @@ class Boxcar2Notifier:
|
||||
def notify_subtitle_download(self, ep_name, lang, title=notifyStrings[NOTIFY_SUBTITLE_DOWNLOAD]):
|
||||
if sickbeard.BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._notifyBoxcar2(title, ep_name + ": " + lang)
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_BOXCAR2:
|
||||
update_text=notifyStrings[NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=notifyStrings[NOTIFY_SICKRAGE_UPDATE]
|
||||
self._notifyBoxcar2(title, update_text + new_version)
|
||||
|
||||
def _notifyBoxcar2(self, title, message, accesstoken=None):
|
||||
"""
|
||||
|
@ -27,7 +27,7 @@ import re
|
||||
|
||||
import sickbeard
|
||||
|
||||
from sickbeard import logger
|
||||
from sickbeard import logger, common
|
||||
from sickbeard import db
|
||||
from sickbeard.exceptions import ex
|
||||
|
||||
@ -141,6 +141,37 @@ 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 _generate_recepients(self, show):
|
||||
addrs = []
|
||||
|
@ -43,6 +43,12 @@ class GrowlNotifier:
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
if sickbeard.GROWL_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._sendGrowl(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD], ep_name + ": " + lang)
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_GROWL:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
|
||||
self._sendGrowl(title, update_text + new_version)
|
||||
|
||||
def _send_growl(self, options, message=None):
|
||||
|
||||
|
@ -92,6 +92,11 @@ class LibnotifyNotifier:
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
if sickbeard.LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._notify(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD], ep_name + ": " + lang)
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_LIBNOTIFY:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT], title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
|
||||
self._notify(title, update_text + new_version)
|
||||
|
||||
def test_notify(self):
|
||||
return self._notify('Test notification', "This is a test notification from SickRage", force=True)
|
||||
|
@ -23,6 +23,12 @@ class NMA_Notifier:
|
||||
if sickbeard.NMA_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
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 = "??"):
|
||||
if sickbeard.USE_NMA:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_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):
|
||||
|
||||
|
@ -96,6 +96,10 @@ class NMJNotifier:
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
if sickbeard.USE_NMJ:
|
||||
self._notifyNMJ()
|
||||
|
||||
def notify_sickrage_update(self, new_version):
|
||||
return False
|
||||
# Not implemented, no reason to start scanner.
|
||||
|
||||
def test_notify(self, host, database, mount):
|
||||
return self._sendNMJ(host, database, mount)
|
||||
|
@ -42,6 +42,10 @@ class NMJv2Notifier:
|
||||
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
self._notifyNMJ()
|
||||
|
||||
def notify_sickrage_update(self, new_version):
|
||||
return False
|
||||
# Not implemented, no reason to start scanner.
|
||||
|
||||
def test_notify(self, host):
|
||||
return self._sendNMJ(host)
|
||||
|
@ -65,6 +65,12 @@ 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 = "??"):
|
||||
if sickbeard.USE_PLEX:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
|
||||
self._notify_pmc(update_text + new_version, title)
|
||||
|
||||
def test_notify(self, host, username, password):
|
||||
return self._notify_pmc("Testing Plex notifications from SickRage", "Test Notification", host, username,
|
||||
|
@ -51,6 +51,13 @@ class ProwlNotifier:
|
||||
if sickbeard.PROWL_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
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 = "??"):
|
||||
if sickbeard.USE_PROWL:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
|
||||
self._sendProwl(prowl_api=None, prowl_priority=None,
|
||||
event=title, message=update_text + new_version)
|
||||
|
||||
def _sendProwl(self, prowl_api=None, prowl_priority=None, event=None, message=None, force=False):
|
||||
|
||||
|
@ -45,6 +45,14 @@ class PushalotNotifier:
|
||||
self._sendPushalot(pushalot_authorizationtoken=None,
|
||||
event=common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD],
|
||||
message=ep_name + ": " + lang)
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_PUSHALOT:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
|
||||
self._sendPushalot(pushalot_authorizationtoken=None,
|
||||
event=title,
|
||||
message=update_text + new_version)
|
||||
|
||||
def _sendPushalot(self, pushalot_authorizationtoken=None, event=None, message=None, force=False):
|
||||
|
||||
|
@ -48,6 +48,12 @@ class PushbulletNotifier:
|
||||
if sickbeard.PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
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 = "??"):
|
||||
if sickbeard.USE_PUSHBULLET:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_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,
|
||||
notificationType=None, method=None, force=False):
|
||||
|
@ -23,7 +23,7 @@ import time
|
||||
|
||||
import sickbeard
|
||||
from sickbeard import logger
|
||||
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD
|
||||
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD, NOTIFY_SICKRAGE_UPDATE, NOTIFY_SICKRAGE_UPDATE_TEXT
|
||||
from sickbeard.exceptions import ex
|
||||
|
||||
API_URL = "https://api.pushover.net/1/messages.json"
|
||||
@ -119,6 +119,12 @@ class PushoverNotifier:
|
||||
def notify_subtitle_download(self, ep_name, lang, title=notifyStrings[NOTIFY_SUBTITLE_DOWNLOAD]):
|
||||
if sickbeard.PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._notifyPushover(title, ep_name + ": " + lang)
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_PUSHOVER:
|
||||
update_text=notifyStrings[NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=notifyStrings[NOTIFY_SICKRAGE_UPDATE]
|
||||
self._notifyPushover(title, update_text + new_version)
|
||||
|
||||
def _notifyPushover(self, title, message, userKey=None, apiKey=None, force=False):
|
||||
"""
|
||||
|
@ -36,6 +36,9 @@ class pyTivoNotifier:
|
||||
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
pass
|
||||
|
||||
def notify_sickrage_update(self, new_version):
|
||||
pass
|
||||
|
||||
def update_library(self, ep_obj):
|
||||
|
||||
|
@ -37,6 +37,9 @@ class synoIndexNotifier:
|
||||
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
pass
|
||||
|
||||
def notify_sickrage_update(self, new_version):
|
||||
pass
|
||||
|
||||
def moveFolder(self, old_path, new_path):
|
||||
self.moveObject(old_path, new_path)
|
||||
|
@ -40,6 +40,12 @@ class synologyNotifier:
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
if sickbeard.SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._send_synologyNotifier(ep_name + ": " + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD])
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_SYNOLOGYNOTIFIER:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
|
||||
self._send_synologyNotifier(update_text + new_version, title)
|
||||
|
||||
def _send_synologyNotifier(self, message, title):
|
||||
synodsmnotify_cmd = ["/usr/syno/bin/synodsmnotify", "@administrators", title, message]
|
||||
|
@ -34,6 +34,9 @@ class TraktNotifier:
|
||||
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
pass
|
||||
|
||||
def notify_sickrage_update(self, new_version):
|
||||
pass
|
||||
|
||||
def update_library(self, ep_obj):
|
||||
"""
|
||||
|
@ -51,6 +51,12 @@ class TwitterNotifier:
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
if sickbeard.TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._notifyTwitter(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD] + ' ' + ep_name + ": " + lang)
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_TWITTER:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
|
||||
self._notifyTwitter(title + " - " + update_text + new_version)
|
||||
|
||||
def test_notify(self):
|
||||
return self._notifyTwitter("This is a test notification from SickRage", force=True)
|
||||
|
@ -512,6 +512,12 @@ class XBMCNotifier:
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
if sickbeard.XBMC_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._notify_xbmc(ep_name + ": " + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD])
|
||||
|
||||
def notify_sickrage_update(self, new_version = "??"):
|
||||
if sickbeard.USE_XBMC:
|
||||
update_text=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE_TEXT]
|
||||
title=common.notifyStrings[common.NOTIFY_SICKRAGE_UPDATE]
|
||||
self._notify_xbmc(update_text + new_version, title)
|
||||
|
||||
def test_notify(self, host, username, password):
|
||||
return self._notify_xbmc("Testing XBMC notifications from SickRage", "Test Notification", host, username,
|
||||
|
@ -30,7 +30,7 @@ import gh_api as github
|
||||
import threading
|
||||
|
||||
import sickbeard
|
||||
from sickbeard import helpers
|
||||
from sickbeard import helpers, notifiers
|
||||
from sickbeard import version, ui
|
||||
from sickbeard import logger
|
||||
from sickbeard.exceptions import ex
|
||||
@ -260,6 +260,9 @@ class WindowsUpdateManager(UpdateManager):
|
||||
new_update_path = os.path.join(sickbeard.PROG_DIR, u'updater.exe')
|
||||
logger.log(u"Copying new update.exe file from " + old_update_path + " to " + new_update_path)
|
||||
shutil.move(old_update_path, new_update_path)
|
||||
|
||||
# Notify update successful
|
||||
notifiers.notify_sickrage_update(sickbeard.NEWEST_VERSION_STRING)
|
||||
|
||||
except Exception, e:
|
||||
logger.log(u"Error while trying to update: " + ex(e), logger.ERROR)
|
||||
@ -412,7 +415,6 @@ class GitUpdateManager(UpdateManager):
|
||||
commit hash. If there is a newer version it sets _num_commits_behind.
|
||||
"""
|
||||
|
||||
self._newest_commit_hash = None
|
||||
self._num_commits_behind = 0
|
||||
self._num_commits_ahead = 0
|
||||
|
||||
@ -510,6 +512,8 @@ class GitUpdateManager(UpdateManager):
|
||||
output, err, exit_status = self._run_git(self._git_path, 'pull origin ' + self.branch) # @UnusedVariable
|
||||
|
||||
if exit_status == 0:
|
||||
# Notify update successful
|
||||
notifiers.notify_sickrage_update(self._newest_commit_hash[:10])
|
||||
return True
|
||||
|
||||
return False
|
||||
@ -715,4 +719,7 @@ class SourceUpdateManager(UpdateManager):
|
||||
logger.log(u"Traceback: " + traceback.format_exc(), logger.DEBUG)
|
||||
return False
|
||||
|
||||
# Notify update successful
|
||||
notifiers.notify_sickrage_update(sickbeard.NEWEST_VERSION_STRING)
|
||||
|
||||
return True
|
||||
|
@ -1401,7 +1401,7 @@ class ConfigGeneral(MainHandler):
|
||||
update_shows_on_start=None, update_frequency=None, launch_browser=None, web_username=None,
|
||||
use_api=None, api_key=None, indexer_default=None, timezone_display=None, cpu_preset=None,
|
||||
web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None,
|
||||
handle_reverse_proxy=None, sort_article=None, auto_update=None, proxy_setting=None,
|
||||
handle_reverse_proxy=None, sort_article=None, auto_update=None, notify_on_update=None, proxy_setting=None,
|
||||
anon_redirect=None, git_path=None, calendar_unprotected=None,
|
||||
fuzzy_dating=None, trim_zero=None, date_preset=None, date_preset_na=None, time_preset=None,
|
||||
indexer_timeout=None):
|
||||
@ -1412,6 +1412,7 @@ class ConfigGeneral(MainHandler):
|
||||
sickbeard.LAUNCH_BROWSER = config.checkbox_to_value(launch_browser)
|
||||
config.change_VERSION_NOTIFY(config.checkbox_to_value(version_notify))
|
||||
sickbeard.AUTO_UPDATE = config.checkbox_to_value(auto_update)
|
||||
sickbeard.NOTIFY_ON_UPDATE = config.checkbox_to_value(notify_on_update)
|
||||
# sickbeard.LOG_DIR is set in config.change_LOG_DIR()
|
||||
|
||||
sickbeard.UPDATE_SHOWS_ON_START = config.checkbox_to_value(update_shows_on_start)
|
||||
|
Loading…
Reference in New Issue
Block a user