mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Remove defunct boxcar notifier
This commit is contained in:
parent
9f46d9f4ef
commit
73bdfc0777
8 changed files with 2 additions and 280 deletions
|
@ -36,6 +36,7 @@
|
|||
* Change The Pirate Bay url back as it's now back up and oldpiratebay hasn't been updated for weeks
|
||||
* Remove duplicate thepiratebay icon
|
||||
* Change to ensure uTorrent API parameters are ordered for uT 2.2.1 compatibility
|
||||
* Remove defunct boxcar notifier
|
||||
|
||||
[develop changelog]
|
||||
* Change uT params from unicode to str.format as magnet URLs worked but sending files in POST bodies failed
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
|
@ -850,73 +850,10 @@
|
|||
</fieldset>
|
||||
</div><!-- /pushover component-group //-->
|
||||
|
||||
<div class="component-group">
|
||||
<div class="component-group-desc">
|
||||
<img class="notifier-icon" src="$sbRoot/images/notifiers/boxcar.png" alt="" title="Boxcar" />
|
||||
<h3><a href="<%= anon_url('http://boxcar.io/') %>" rel="noreferrer" onclick="window.open(this.href, '_blank'); return false;">Boxcar</a></h3>
|
||||
<p>Universal push notification for iOS. Read your messages where and when you want them! A subscription will be sent if needed.</p>
|
||||
</div>
|
||||
<fieldset class="component-group-list">
|
||||
<div class="field-pair">
|
||||
<label for="use_boxcar">
|
||||
<span class="component-title">Enable</span>
|
||||
<span class="component-desc">
|
||||
<input type="checkbox" class="enabler" name="use_boxcar" id="use_boxcar" #if $sickbeard.USE_BOXCAR then "checked=\"checked\"" else ""# />
|
||||
<p>should SickGear send Boxcar notifications ?</p>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="content_use_boxcar">
|
||||
<div class="field-pair">
|
||||
<label for="boxcar_notify_onsnatch">
|
||||
<span class="component-title">Notify on snatch</span>
|
||||
<span class="component-desc">
|
||||
<input type="checkbox" name="boxcar_notify_onsnatch" id="boxcar_notify_onsnatch" #if $sickbeard.BOXCAR_NOTIFY_ONSNATCH then "checked=\"checked\"" else ""# />
|
||||
<p>send a notification when a download starts ?</p>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<label for="boxcar_notify_ondownload">
|
||||
<span class="component-title">Notify on download</span>
|
||||
<span class="component-desc">
|
||||
<input type="checkbox" name="boxcar_notify_ondownload" id="boxcar_notify_ondownload" #if $sickbeard.BOXCAR_NOTIFY_ONDOWNLOAD then "checked=\"checked\"" else ""# />
|
||||
<p>send a notification when a download finishes ?</p>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<label for="boxcar_notify_onsubtitledownload">
|
||||
<span class="component-title">Notify on subtitle download</span>
|
||||
<span class="component-desc">
|
||||
<input type="checkbox" name="boxcar_notify_onsubtitledownload" id="boxcar_notify_onsubtitledownload" #if $sickbeard.BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD then "checked=\"checked\"" else ""# />
|
||||
<p>send a notification when subtitles are downloaded ?</p>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<label for="boxcar_username">
|
||||
<span class="component-title">Boxcar username</span>
|
||||
<input type="text" name="boxcar_username" id="boxcar_username" value="$sickbeard.BOXCAR_USERNAME" class="form-control input-sm input250" />
|
||||
</label>
|
||||
<label>
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">username of your Boxcar account</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="testNotification" id="testBoxcar-result">Click below to test.</div>
|
||||
<input class="btn" type="button" value="Test Boxcar" id="testBoxcar" />
|
||||
<input type="submit" class="config_submitter btn" value="Save Changes" />
|
||||
</div><!-- /content_use_boxcar //-->
|
||||
|
||||
</fieldset>
|
||||
</div><!-- /boxcar component-group //-->
|
||||
|
||||
<div class="component-group">
|
||||
<div class="component-group-desc">
|
||||
<img class="notifier-icon" src="$sbRoot/images/notifiers/boxcar2.png" alt="" title="Boxcar2"/>
|
||||
<h3><a href="<%= anon_url('https://new.boxcar.io/') %>" rel="noreferrer" onclick="window.open(this.href, '_blank'); return false;">Boxcar2</a></h3>
|
||||
<h3><a href="<%= anon_url('https://boxcar.io/') %>" rel="noreferrer" onclick="window.open(this.href, '_blank'); return false;">Boxcar2</a></h3>
|
||||
<p>Read your messages where and when you want them!</p>
|
||||
</div>
|
||||
<fieldset class="component-group-list">
|
||||
|
|
|
@ -74,23 +74,6 @@ $(document).ready(function(){
|
|||
$('#testPLEX').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testBoxcar').click(function() {
|
||||
var boxcar_username = $.trim($('#boxcar_username').val());
|
||||
if (!boxcar_username) {
|
||||
$('#testBoxcar-result').html('Please fill out the necessary fields above.');
|
||||
$('#boxcar_username').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#boxcar_username').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testBoxcar-result').html(loading);
|
||||
$.get(sbRoot + '/home/testBoxcar', {'username': boxcar_username})
|
||||
.done(function (data) {
|
||||
$('#testBoxcar-result').html(data);
|
||||
$('#testBoxcar').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testBoxcar2').click(function () {
|
||||
var boxcar2_accesstoken = $.trim($('#boxcar2_accesstoken').val());
|
||||
|
|
|
@ -309,14 +309,6 @@ TWITTER_USERNAME = None
|
|||
TWITTER_PASSWORD = None
|
||||
TWITTER_PREFIX = None
|
||||
|
||||
USE_BOXCAR = False
|
||||
BOXCAR_NOTIFY_ONSNATCH = False
|
||||
BOXCAR_NOTIFY_ONDOWNLOAD = False
|
||||
BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD = False
|
||||
BOXCAR_USERNAME = None
|
||||
BOXCAR_PASSWORD = None
|
||||
BOXCAR_PREFIX = None
|
||||
|
||||
USE_BOXCAR2 = False
|
||||
BOXCAR2_NOTIFY_ONSNATCH = False
|
||||
BOXCAR2_NOTIFY_ONDOWNLOAD = False
|
||||
|
@ -491,7 +483,6 @@ def initialize(consoleLogging=True):
|
|||
RENAME_EPISODES, AIRDATE_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \
|
||||
WOMBLE, OMGWTFNZBS, OMGWTFNZBS_USERNAME, OMGWTFNZBS_APIKEY, providerList, newznabProviderList, torrentRssProviderList, \
|
||||
EXTRA_SCRIPTS, USE_TWITTER, TWITTER_USERNAME, TWITTER_PASSWORD, TWITTER_PREFIX, RECENTSEARCH_FREQUENCY, \
|
||||
USE_BOXCAR, BOXCAR_USERNAME, BOXCAR_PASSWORD, BOXCAR_NOTIFY_ONDOWNLOAD, BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD, BOXCAR_NOTIFY_ONSNATCH, \
|
||||
USE_BOXCAR2, BOXCAR2_ACCESSTOKEN, BOXCAR2_NOTIFY_ONDOWNLOAD, BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD, BOXCAR2_NOTIFY_ONSNATCH, \
|
||||
USE_PUSHOVER, PUSHOVER_USERKEY, PUSHOVER_APIKEY, PUSHOVER_NOTIFY_ONDOWNLOAD, PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHOVER_NOTIFY_ONSNATCH, \
|
||||
USE_LIBNOTIFY, LIBNOTIFY_NOTIFY_ONSNATCH, LIBNOTIFY_NOTIFY_ONDOWNLOAD, LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD, USE_NMJ, NMJ_HOST, NMJ_DATABASE, NMJ_MOUNT, USE_NMJv2, NMJv2_HOST, NMJv2_DATABASE, NMJv2_DBLOC, USE_SYNOINDEX, \
|
||||
|
@ -521,7 +512,6 @@ def initialize(consoleLogging=True):
|
|||
CheckSection(CFG, 'Growl')
|
||||
CheckSection(CFG, 'Prowl')
|
||||
CheckSection(CFG, 'Twitter')
|
||||
CheckSection(CFG, 'Boxcar')
|
||||
CheckSection(CFG, 'Boxcar2')
|
||||
CheckSection(CFG, 'NMJ')
|
||||
CheckSection(CFG, 'NMJv2')
|
||||
|
@ -793,12 +783,6 @@ def initialize(consoleLogging=True):
|
|||
TWITTER_PASSWORD = check_setting_str(CFG, 'Twitter', 'twitter_password', '')
|
||||
TWITTER_PREFIX = check_setting_str(CFG, 'Twitter', 'twitter_prefix', 'SickGear')
|
||||
|
||||
USE_BOXCAR = bool(check_setting_int(CFG, 'Boxcar', 'use_boxcar', 0))
|
||||
BOXCAR_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Boxcar', 'boxcar_notify_onsnatch', 0))
|
||||
BOXCAR_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Boxcar', 'boxcar_notify_ondownload', 0))
|
||||
BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Boxcar', 'boxcar_notify_onsubtitledownload', 0))
|
||||
BOXCAR_USERNAME = check_setting_str(CFG, 'Boxcar', 'boxcar_username', '')
|
||||
|
||||
USE_BOXCAR2 = bool(check_setting_int(CFG, 'Boxcar2', 'use_boxcar2', 0))
|
||||
BOXCAR2_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Boxcar2', 'boxcar2_notify_onsnatch', 0))
|
||||
BOXCAR2_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Boxcar2', 'boxcar2_notify_ondownload', 0))
|
||||
|
@ -1641,13 +1625,6 @@ def save_config():
|
|||
new_config['Twitter']['twitter_password'] = helpers.encrypt(TWITTER_PASSWORD, ENCRYPTION_VERSION)
|
||||
new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX
|
||||
|
||||
new_config['Boxcar'] = {}
|
||||
new_config['Boxcar']['use_boxcar'] = int(USE_BOXCAR)
|
||||
new_config['Boxcar']['boxcar_notify_onsnatch'] = int(BOXCAR_NOTIFY_ONSNATCH)
|
||||
new_config['Boxcar']['boxcar_notify_ondownload'] = int(BOXCAR_NOTIFY_ONDOWNLOAD)
|
||||
new_config['Boxcar']['boxcar_notify_onsubtitledownload'] = int(BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD)
|
||||
new_config['Boxcar']['boxcar_username'] = BOXCAR_USERNAME
|
||||
|
||||
new_config['Boxcar2'] = {}
|
||||
new_config['Boxcar2']['use_boxcar2'] = int(USE_BOXCAR2)
|
||||
new_config['Boxcar2']['boxcar2_notify_onsnatch'] = int(BOXCAR2_NOTIFY_ONSNATCH)
|
||||
|
|
|
@ -30,7 +30,6 @@ import growl
|
|||
import prowl
|
||||
from . import libnotify
|
||||
import pushover
|
||||
import boxcar
|
||||
import boxcar2
|
||||
import nma
|
||||
import pushalot
|
||||
|
@ -55,7 +54,6 @@ growl_notifier = growl.GrowlNotifier()
|
|||
prowl_notifier = prowl.ProwlNotifier()
|
||||
libnotify_notifier = libnotify.LibnotifyNotifier()
|
||||
pushover_notifier = pushover.PushoverNotifier()
|
||||
boxcar_notifier = boxcar.BoxcarNotifier()
|
||||
boxcar2_notifier = boxcar2.Boxcar2Notifier()
|
||||
nma_notifier = nma.NMA_Notifier()
|
||||
pushalot_notifier = pushalot.PushalotNotifier()
|
||||
|
@ -77,7 +75,6 @@ notifiers = [
|
|||
growl_notifier,
|
||||
prowl_notifier,
|
||||
pushover_notifier,
|
||||
boxcar_notifier,
|
||||
boxcar2_notifier,
|
||||
nma_notifier,
|
||||
pushalot_notifier,
|
||||
|
|
|
@ -1,155 +0,0 @@
|
|||
# Author: Marvin Pinto <me@marvinp.ca>
|
||||
# Author: Dennis Lutter <lad1337@gmail.com>
|
||||
# URL: http://code.google.com/p/sickbeard/
|
||||
#
|
||||
# This file is part of SickGear.
|
||||
#
|
||||
# SickGear is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# SickGear 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import urllib, urllib2
|
||||
import time
|
||||
|
||||
import sickbeard
|
||||
|
||||
from sickbeard import logger
|
||||
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"
|
||||
|
||||
|
||||
class BoxcarNotifier:
|
||||
def test_notify(self, boxcar_username):
|
||||
return self._notify("This is a test notification from Sick Beard", "Test", boxcar_username, force=True)
|
||||
|
||||
def _sendBoxcar(self, msg, title, email, subscribe=False):
|
||||
"""
|
||||
Sends a boxcar notification to the address provided
|
||||
|
||||
msg: The message to send (unicode)
|
||||
title: The title of the message
|
||||
email: The email address to send the message to (or to subscribe with)
|
||||
subscribe: If true then instead of sending a message this function will send a subscription notification (optional, default is False)
|
||||
|
||||
returns: True if the message succeeded, False otherwise
|
||||
"""
|
||||
|
||||
# build up the URL and parameters
|
||||
msg = msg.strip()
|
||||
curUrl = API_URL
|
||||
|
||||
# if this is a subscription notification then act accordingly
|
||||
if subscribe:
|
||||
data = urllib.urlencode({'email': email})
|
||||
curUrl = curUrl + "/subscribe"
|
||||
|
||||
# for normal requests we need all these parameters
|
||||
else:
|
||||
data = urllib.urlencode({
|
||||
'email': email,
|
||||
'notification[from_screen_name]': title,
|
||||
'notification[message]': msg.encode('utf-8'),
|
||||
'notification[from_remote_service_id]': int(time.time())
|
||||
})
|
||||
|
||||
|
||||
# send the request to boxcar
|
||||
try:
|
||||
req = urllib2.Request(curUrl)
|
||||
handle = urllib2.urlopen(req, data)
|
||||
handle.close()
|
||||
|
||||
except urllib2.HTTPError, e:
|
||||
# if we get an error back that doesn't have an error code then who knows what's really happening
|
||||
if not hasattr(e, 'code'):
|
||||
logger.log("Boxcar notification failed. Error code: " + ex(e), logger.ERROR)
|
||||
return False
|
||||
else:
|
||||
logger.log("Boxcar notification failed. Error code: " + str(e.code), logger.WARNING)
|
||||
|
||||
# HTTP status 404 if the provided email address isn't a Boxcar user.
|
||||
if e.code == 404:
|
||||
logger.log("Username is wrong/not a boxcar email. Boxcar will send an email to it", logger.WARNING)
|
||||
return False
|
||||
|
||||
# For HTTP status code 401's, it is because you are passing in either an invalid token, or the user has not added your service.
|
||||
elif e.code == 401:
|
||||
|
||||
# If the user has already added your service, we'll return an HTTP status code of 401.
|
||||
if subscribe:
|
||||
logger.log("Already subscribed to service", logger.ERROR)
|
||||
# i dont know if this is true or false ... its neither but i also dont know how we got here in the first place
|
||||
return False
|
||||
|
||||
#HTTP status 401 if the user doesn't have the service added
|
||||
else:
|
||||
subscribeNote = self._sendBoxcar(msg, title, email, True)
|
||||
if subscribeNote:
|
||||
logger.log("Subscription send", logger.DEBUG)
|
||||
return True
|
||||
else:
|
||||
logger.log("Subscription could not be send", logger.ERROR)
|
||||
return False
|
||||
|
||||
# If you receive an HTTP status code of 400, it is because you failed to send the proper parameters
|
||||
elif e.code == 400:
|
||||
logger.log("Wrong data sent to boxcar", logger.ERROR)
|
||||
return False
|
||||
|
||||
logger.log("Boxcar notification successful.", logger.MESSAGE)
|
||||
return True
|
||||
|
||||
def notify_snatch(self, ep_name, title=notifyStrings[NOTIFY_SNATCH]):
|
||||
if sickbeard.BOXCAR_NOTIFY_ONSNATCH:
|
||||
self._notifyBoxcar(title, ep_name)
|
||||
|
||||
|
||||
def notify_download(self, ep_name, title=notifyStrings[NOTIFY_DOWNLOAD]):
|
||||
if sickbeard.BOXCAR_NOTIFY_ONDOWNLOAD:
|
||||
self._notifyBoxcar(title, ep_name)
|
||||
|
||||
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_git_update(self, new_version = "??"):
|
||||
if sickbeard.USE_BOXCAR:
|
||||
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):
|
||||
"""
|
||||
Sends a boxcar notification based on the provided info or SB config
|
||||
|
||||
title: The title of the notification to send
|
||||
message: The message string to send
|
||||
username: The username to send the notification to (optional, defaults to the username in the config)
|
||||
force: If True then the notification will be sent even if Boxcar is disabled in the config
|
||||
"""
|
||||
|
||||
if not sickbeard.USE_BOXCAR and not force:
|
||||
logger.log("Notification for Boxcar not enabled, skipping this notification", logger.DEBUG)
|
||||
return False
|
||||
|
||||
# if no username was given then use the one from the config
|
||||
if not username:
|
||||
username = sickbeard.BOXCAR_USERNAME
|
||||
|
||||
logger.log("Sending notification for " + message, logger.DEBUG)
|
||||
|
||||
return self._sendBoxcar(message, title, username)
|
||||
|
||||
|
||||
notifier = BoxcarNotifier
|
|
@ -2344,8 +2344,6 @@ class ConfigNotifications(MainHandler):
|
|||
prowl_notify_onsubtitledownload=None, prowl_api=None, prowl_priority=0,
|
||||
use_twitter=None, twitter_notify_onsnatch=None, twitter_notify_ondownload=None,
|
||||
twitter_notify_onsubtitledownload=None,
|
||||
use_boxcar=None, boxcar_notify_onsnatch=None, boxcar_notify_ondownload=None,
|
||||
boxcar_notify_onsubtitledownload=None, boxcar_username=None,
|
||||
use_boxcar2=None, boxcar2_notify_onsnatch=None, boxcar2_notify_ondownload=None,
|
||||
boxcar2_notify_onsubtitledownload=None, boxcar2_accesstoken=None,
|
||||
use_pushover=None, pushover_notify_onsnatch=None, pushover_notify_ondownload=None,
|
||||
|
@ -2418,12 +2416,6 @@ class ConfigNotifications(MainHandler):
|
|||
sickbeard.TWITTER_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(twitter_notify_ondownload)
|
||||
sickbeard.TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(twitter_notify_onsubtitledownload)
|
||||
|
||||
sickbeard.USE_BOXCAR = config.checkbox_to_value(use_boxcar)
|
||||
sickbeard.BOXCAR_NOTIFY_ONSNATCH = config.checkbox_to_value(boxcar_notify_onsnatch)
|
||||
sickbeard.BOXCAR_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(boxcar_notify_ondownload)
|
||||
sickbeard.BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(boxcar_notify_onsubtitledownload)
|
||||
sickbeard.BOXCAR_USERNAME = boxcar_username
|
||||
|
||||
sickbeard.USE_BOXCAR2 = config.checkbox_to_value(use_boxcar2)
|
||||
sickbeard.BOXCAR2_NOTIFY_ONSNATCH = config.checkbox_to_value(boxcar2_notify_onsnatch)
|
||||
sickbeard.BOXCAR2_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(boxcar2_notify_ondownload)
|
||||
|
@ -3357,16 +3349,6 @@ class Home(MainHandler):
|
|||
return "Test prowl notice failed"
|
||||
|
||||
|
||||
def testBoxcar(self, username=None):
|
||||
self.set_header('Cache-Control', 'max-age=0,no-cache,no-store')
|
||||
|
||||
result = notifiers.boxcar_notifier.test_notify(username)
|
||||
if result:
|
||||
return "Boxcar notification succeeded. Check your Boxcar clients to make sure it worked"
|
||||
else:
|
||||
return "Error sending Boxcar notification"
|
||||
|
||||
|
||||
def testBoxcar2(self, accesstoken=None):
|
||||
self.set_header('Cache-Control', 'max-age=0,no-cache,no-store')
|
||||
|
||||
|
|
Loading…
Reference in a new issue