mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Merge pull request #180 from Supremicus/feature/BoxcarChanges
Remove defunct Boxcar notifier / Update Boxcar 2 notifier
This commit is contained in:
commit
50e956d188
9 changed files with 1977 additions and 2204 deletions
|
@ -36,6 +36,9 @@
|
|||
* 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
|
||||
* Add sound selection for boxcar2 notifier
|
||||
* Change boxcar2 notifier to use updated api scheme
|
||||
|
||||
[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 |
File diff suppressed because it is too large
Load diff
|
@ -1,119 +1,103 @@
|
|||
$(document).ready(function(){
|
||||
var loading = '<img src="' + sbRoot + '/images/loading16' + themeSpinner + '.gif" height="16" width="16" />';
|
||||
var loading = '<img src="' + sbRoot + '/images/loading16' + themeSpinner + '.gif" height="16" width="16" />';
|
||||
|
||||
$('#testGrowl').click(function () {
|
||||
var growl_host = $.trim($('#growl_host').val());
|
||||
var growl_password = $.trim($('#growl_password').val());
|
||||
if (!growl_host) {
|
||||
$('#testGrowl-result').html('Please fill out the necessary fields above.');
|
||||
$('#testGrowl').click(function () {
|
||||
var growl_host = $.trim($('#growl_host').val());
|
||||
var growl_password = $.trim($('#growl_password').val());
|
||||
if (!growl_host) {
|
||||
$('#testGrowl-result').html('Please fill out the necessary fields above.');
|
||||
$('#growl_host').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#growl_host').removeClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#growl_host').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testGrowl-result').html(loading);
|
||||
$.get(sbRoot + '/home/testGrowl', {'host': growl_host, 'password': growl_password})
|
||||
.done(function (data) {
|
||||
$('#testGrowl-result').html(data);
|
||||
$('#testGrowl').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
$('#testGrowl-result').html(loading);
|
||||
$.get(sbRoot + '/home/testGrowl', {'host': growl_host, 'password': growl_password})
|
||||
.done(function (data) {
|
||||
$('#testGrowl-result').html(data);
|
||||
$('#testGrowl').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testProwl').click(function () {
|
||||
var prowl_api = $.trim($('#prowl_api').val());
|
||||
var prowl_priority = $('#prowl_priority').val();
|
||||
if (!prowl_api) {
|
||||
$('#testProwl-result').html('Please fill out the necessary fields above.');
|
||||
$('#testProwl').click(function () {
|
||||
var prowl_api = $.trim($('#prowl_api').val());
|
||||
var prowl_priority = $('#prowl_priority').val();
|
||||
if (!prowl_api) {
|
||||
$('#testProwl-result').html('Please fill out the necessary fields above.');
|
||||
$('#prowl_api').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#prowl_api').removeClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#prowl_api').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testProwl-result').html(loading);
|
||||
$.get(sbRoot + '/home/testProwl', {'prowl_api': prowl_api, 'prowl_priority': prowl_priority})
|
||||
.done(function (data) {
|
||||
$('#testProwl-result').html(data);
|
||||
$('#testProwl').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testXBMC').click(function () {
|
||||
var xbmc_host = $.trim($('#xbmc_host').val());
|
||||
var xbmc_username = $.trim($('#xbmc_username').val());
|
||||
var xbmc_password = $.trim($('#xbmc_password').val());
|
||||
if (!xbmc_host) {
|
||||
$('#testXBMC-result').html('Please fill out the necessary fields above.');
|
||||
$('#testProwl-result').html(loading);
|
||||
$.get(sbRoot + '/home/testProwl', {'prowl_api': prowl_api, 'prowl_priority': prowl_priority})
|
||||
.done(function (data) {
|
||||
$('#testProwl-result').html(data);
|
||||
$('#testProwl').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testXBMC').click(function () {
|
||||
var xbmc_host = $.trim($('#xbmc_host').val());
|
||||
var xbmc_username = $.trim($('#xbmc_username').val());
|
||||
var xbmc_password = $.trim($('#xbmc_password').val());
|
||||
if (!xbmc_host) {
|
||||
$('#testXBMC-result').html('Please fill out the necessary fields above.');
|
||||
$('#xbmc_host').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#xbmc_host').removeClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#xbmc_host').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testXBMC-result').html(loading);
|
||||
$.get(sbRoot + '/home/testXBMC', {'host': xbmc_host, 'username': xbmc_username, 'password': xbmc_password})
|
||||
.done(function (data) {
|
||||
$('#testXBMC-result').html(data);
|
||||
$('#testXBMC').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
$('#testXBMC-result').html(loading);
|
||||
$.get(sbRoot + '/home/testXBMC', {'host': xbmc_host, 'username': xbmc_username, 'password': xbmc_password})
|
||||
.done(function (data) {
|
||||
$('#testXBMC-result').html(data);
|
||||
$('#testXBMC').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testPLEX').click(function () {
|
||||
var plex_host = $.trim($('#plex_host').val());
|
||||
var plex_username = $.trim($('#plex_username').val());
|
||||
var plex_password = $.trim($('#plex_password').val());
|
||||
if (!plex_host) {
|
||||
$('#testPLEX-result').html('Please fill out the necessary fields above.');
|
||||
$('#testPLEX').click(function () {
|
||||
var plex_host = $.trim($('#plex_host').val());
|
||||
var plex_username = $.trim($('#plex_username').val());
|
||||
var plex_password = $.trim($('#plex_password').val());
|
||||
if (!plex_host) {
|
||||
$('#testPLEX-result').html('Please fill out the necessary fields above.');
|
||||
$('#plex_host').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#plex_host').removeClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#plex_host').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testPLEX-result').html(loading);
|
||||
$.get(sbRoot + '/home/testPLEX', {'host': plex_host, 'username': plex_username, 'password': plex_password})
|
||||
.done(function (data) {
|
||||
$('#testPLEX-result').html(data);
|
||||
$('#testPLEX').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
$('#testPLEX-result').html(loading);
|
||||
$.get(sbRoot + '/home/testPLEX', {'host': plex_host, 'username': plex_username, 'password': plex_password})
|
||||
.done(function (data) {
|
||||
$('#testPLEX-result').html(data);
|
||||
$('#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());
|
||||
if (!boxcar2_accesstoken) {
|
||||
$('#testBoxcar2-result').html('Please fill out the necessary fields above.');
|
||||
$('#testBoxcar2').click(function () {
|
||||
var boxcar2_accesstoken = $.trim($('#boxcar2_accesstoken').val());
|
||||
var boxcar2_sound = $('#boxcar2_sound').val() || 'default';
|
||||
if (!boxcar2_accesstoken) {
|
||||
$('#testBoxcar2-result').html('Please fill out the necessary fields above.');
|
||||
$('#boxcar2_accesstoken').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#boxcar2_accesstoken').removeClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#boxcar2_accesstoken').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testBoxcar2-result').html(loading);
|
||||
$.get(sbRoot + '/home/testBoxcar2', {'accessToken': boxcar2_accesstoken})
|
||||
.done(function (data) {
|
||||
$('#testBoxcar2-result').html(data);
|
||||
$('#testBoxcar2').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
$('#testBoxcar2-result').html(loading);
|
||||
$.get(sbRoot + '/home/testBoxcar2', {'accesstoken': boxcar2_accesstoken, 'sound': boxcar2_sound})
|
||||
.done(function (data) {
|
||||
$('#testBoxcar2-result').html(data);
|
||||
$('#testBoxcar2').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testPushover').click(function () {
|
||||
var pushover_userkey = $('#pushover_userkey').val();
|
||||
var pushover_apikey = $('#pushover_apikey').val();
|
||||
if (!pushover_userkey || !pushover_apikey) {
|
||||
$('#testPushover-result').html('Please fill out the necessary fields above.');
|
||||
$('#testPushover').click(function () {
|
||||
var pushover_userkey = $('#pushover_userkey').val();
|
||||
var pushover_apikey = $('#pushover_apikey').val();
|
||||
if (!pushover_userkey || !pushover_apikey) {
|
||||
$('#testPushover-result').html('Please fill out the necessary fields above.');
|
||||
if (!pushover_userkey) {
|
||||
$('#pushover_userkey').addClass('warning');
|
||||
} else {
|
||||
|
@ -124,108 +108,108 @@ $(document).ready(function(){
|
|||
} else {
|
||||
$('#pushover_apikey').removeClass('warning');
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
$('#pushover_userkey,#pushover_apikey').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testPushover-result').html(loading);
|
||||
$.get(sbRoot + '/home/testPushover', {'userKey': pushover_userkey, 'apiKey': pushover_apikey})
|
||||
.done(function (data) {
|
||||
$('#testPushover-result').html(data);
|
||||
$('#testPushover').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
$('#testPushover-result').html(loading);
|
||||
$.get(sbRoot + '/home/testPushover', {'userKey': pushover_userkey, 'apiKey': pushover_apikey})
|
||||
.done(function (data) {
|
||||
$('#testPushover-result').html(data);
|
||||
$('#testPushover').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testLibnotify').click(function() {
|
||||
$('#testLibnotify-result').html(loading);
|
||||
$.get(sbRoot + '/home/testLibnotify',
|
||||
function (data) { $('#testLibnotify-result').html(data); });
|
||||
});
|
||||
$('#testLibnotify').click(function() {
|
||||
$('#testLibnotify-result').html(loading);
|
||||
$.get(sbRoot + '/home/testLibnotify',
|
||||
function (data) { $('#testLibnotify-result').html(data); });
|
||||
});
|
||||
|
||||
$('#twitterStep1').click(function() {
|
||||
$('#testTwitter-result').html(loading);
|
||||
$.get(sbRoot + '/home/twitterStep1', function (data) {window.open(data); })
|
||||
.done(function () { $('#testTwitter-result').html('<b>Step1:</b> Confirm Authorization'); });
|
||||
});
|
||||
$('#twitterStep1').click(function() {
|
||||
$('#testTwitter-result').html(loading);
|
||||
$.get(sbRoot + '/home/twitterStep1', function (data) {window.open(data); })
|
||||
.done(function () { $('#testTwitter-result').html('<b>Step1:</b> Confirm Authorization'); });
|
||||
});
|
||||
|
||||
$('#twitterStep2').click(function () {
|
||||
var twitter_key = $.trim($('#twitter_key').val());
|
||||
if (!twitter_key) {
|
||||
$('#testTwitter-result').html('Please fill out the necessary fields above.');
|
||||
$('#twitterStep2').click(function () {
|
||||
var twitter_key = $.trim($('#twitter_key').val());
|
||||
if (!twitter_key) {
|
||||
$('#testTwitter-result').html('Please fill out the necessary fields above.');
|
||||
$('#twitter_key').addClass('warning');
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
$('#twitter_key').removeClass('warning');
|
||||
$('#testTwitter-result').html(loading);
|
||||
$.get(sbRoot + '/home/twitterStep2', {'key': twitter_key},
|
||||
function (data) { $('#testTwitter-result').html(data); });
|
||||
});
|
||||
$('#testTwitter-result').html(loading);
|
||||
$.get(sbRoot + '/home/twitterStep2', {'key': twitter_key},
|
||||
function (data) { $('#testTwitter-result').html(data); });
|
||||
});
|
||||
|
||||
$('#testTwitter').click(function() {
|
||||
$.get(sbRoot + '/home/testTwitter',
|
||||
function (data) { $('#testTwitter-result').html(data); });
|
||||
});
|
||||
$('#testTwitter').click(function() {
|
||||
$.get(sbRoot + '/home/testTwitter',
|
||||
function (data) { $('#testTwitter-result').html(data); });
|
||||
});
|
||||
|
||||
$('#settingsNMJ').click(function() {
|
||||
if (!$('#nmj_host').val()) {
|
||||
alert('Please fill in the Popcorn IP address');
|
||||
$('#nmj_host').focus();
|
||||
return;
|
||||
}
|
||||
$('#testNMJ-result').html(loading);
|
||||
var nmj_host = $('#nmj_host').val();
|
||||
|
||||
$.get(sbRoot + '/home/settingsNMJ', {'host': nmj_host},
|
||||
function (data) {
|
||||
if (data === null) {
|
||||
$('#nmj_database').removeAttr('readonly');
|
||||
$('#nmj_mount').removeAttr('readonly');
|
||||
}
|
||||
var JSONData = $.parseJSON(data);
|
||||
$('#testNMJ-result').html(JSONData.message);
|
||||
$('#nmj_database').val(JSONData.database);
|
||||
$('#nmj_mount').val(JSONData.mount);
|
||||
$('#settingsNMJ').click(function() {
|
||||
if (!$('#nmj_host').val()) {
|
||||
alert('Please fill in the Popcorn IP address');
|
||||
$('#nmj_host').focus();
|
||||
return;
|
||||
}
|
||||
$('#testNMJ-result').html(loading);
|
||||
var nmj_host = $('#nmj_host').val();
|
||||
|
||||
$.get(sbRoot + '/home/settingsNMJ', {'host': nmj_host},
|
||||
function (data) {
|
||||
if (data === null) {
|
||||
$('#nmj_database').removeAttr('readonly');
|
||||
$('#nmj_mount').removeAttr('readonly');
|
||||
}
|
||||
var JSONData = $.parseJSON(data);
|
||||
$('#testNMJ-result').html(JSONData.message);
|
||||
$('#nmj_database').val(JSONData.database);
|
||||
$('#nmj_mount').val(JSONData.mount);
|
||||
|
||||
if (JSONData.database) {
|
||||
$('#nmj_database').attr('readonly', true);
|
||||
} else {
|
||||
$('#nmj_database').removeAttr('readonly');
|
||||
}
|
||||
if (JSONData.mount) {
|
||||
$('#nmj_mount').attr('readonly', true);
|
||||
} else {
|
||||
$('#nmj_mount').removeAttr('readonly');
|
||||
}
|
||||
});
|
||||
});
|
||||
if (JSONData.database) {
|
||||
$('#nmj_database').attr('readonly', true);
|
||||
} else {
|
||||
$('#nmj_database').removeAttr('readonly');
|
||||
}
|
||||
if (JSONData.mount) {
|
||||
$('#nmj_mount').attr('readonly', true);
|
||||
} else {
|
||||
$('#nmj_mount').removeAttr('readonly');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#testNMJ').click(function () {
|
||||
var nmj_host = $.trim($('#nmj_host').val());
|
||||
var nmj_database = $('#nmj_database').val();
|
||||
var nmj_mount = $('#nmj_mount').val();
|
||||
if (!nmj_host) {
|
||||
$('#testNMJ-result').html('Please fill out the necessary fields above.');
|
||||
$('#testNMJ').click(function () {
|
||||
var nmj_host = $.trim($('#nmj_host').val());
|
||||
var nmj_database = $('#nmj_database').val();
|
||||
var nmj_mount = $('#nmj_mount').val();
|
||||
if (!nmj_host) {
|
||||
$('#testNMJ-result').html('Please fill out the necessary fields above.');
|
||||
$('#nmj_host').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#nmj_host').removeClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#nmj_host').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testNMJ-result').html(loading);
|
||||
$.get(sbRoot + '/home/testNMJ', {'host': nmj_host, 'database': nmj_database, 'mount': nmj_mount})
|
||||
.done(function (data) {
|
||||
$('#testNMJ-result').html(data);
|
||||
$('#testNMJ').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
$('#testNMJ-result').html(loading);
|
||||
$.get(sbRoot + '/home/testNMJ', {'host': nmj_host, 'database': nmj_database, 'mount': nmj_mount})
|
||||
.done(function (data) {
|
||||
$('#testNMJ-result').html(data);
|
||||
$('#testNMJ').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#settingsNMJv2').click(function() {
|
||||
if (!$('#nmjv2_host').val()) {
|
||||
alert('Please fill in the Popcorn IP address');
|
||||
$('#nmjv2_host').focus();
|
||||
return;
|
||||
}
|
||||
$('#testNMJv2-result').html(loading);
|
||||
var nmjv2_host = $('#nmjv2_host').val();
|
||||
if (!$('#nmjv2_host').val()) {
|
||||
alert('Please fill in the Popcorn IP address');
|
||||
$('#nmjv2_host').focus();
|
||||
return;
|
||||
}
|
||||
$('#testNMJv2-result').html(loading);
|
||||
var nmjv2_host = $('#nmjv2_host').val();
|
||||
var nmjv2_dbloc;
|
||||
var radios = document.getElementsByName('nmjv2_dbloc');
|
||||
for (var i = 0; i < radios.length; i++) {
|
||||
|
@ -235,46 +219,46 @@ $(document).ready(function(){
|
|||
}
|
||||
}
|
||||
|
||||
var nmjv2_dbinstance=$('#NMJv2db_instance').val();
|
||||
$.get(sbRoot + '/home/settingsNMJv2', {'host': nmjv2_host,'dbloc': nmjv2_dbloc,'instance': nmjv2_dbinstance},
|
||||
function (data){
|
||||
if (data == null) {
|
||||
$('#nmjv2_database').removeAttr('readonly');
|
||||
}
|
||||
var JSONData = $.parseJSON(data);
|
||||
$('#testNMJv2-result').html(JSONData.message);
|
||||
$('#nmjv2_database').val(JSONData.database);
|
||||
|
||||
if (JSONData.database)
|
||||
$('#nmjv2_database').attr('readonly', true);
|
||||
else
|
||||
$('#nmjv2_database').removeAttr('readonly');
|
||||
});
|
||||
});
|
||||
var nmjv2_dbinstance=$('#NMJv2db_instance').val();
|
||||
$.get(sbRoot + '/home/settingsNMJv2', {'host': nmjv2_host,'dbloc': nmjv2_dbloc,'instance': nmjv2_dbinstance},
|
||||
function (data){
|
||||
if (data == null) {
|
||||
$('#nmjv2_database').removeAttr('readonly');
|
||||
}
|
||||
var JSONData = $.parseJSON(data);
|
||||
$('#testNMJv2-result').html(JSONData.message);
|
||||
$('#nmjv2_database').val(JSONData.database);
|
||||
|
||||
if (JSONData.database)
|
||||
$('#nmjv2_database').attr('readonly', true);
|
||||
else
|
||||
$('#nmjv2_database').removeAttr('readonly');
|
||||
});
|
||||
});
|
||||
|
||||
$('#testNMJv2').click(function () {
|
||||
var nmjv2_host = $.trim($('#nmjv2_host').val());
|
||||
if (!nmjv2_host) {
|
||||
$('#testNMJv2-result').html('Please fill out the necessary fields above.');
|
||||
$('#testNMJv2').click(function () {
|
||||
var nmjv2_host = $.trim($('#nmjv2_host').val());
|
||||
if (!nmjv2_host) {
|
||||
$('#testNMJv2-result').html('Please fill out the necessary fields above.');
|
||||
$('#nmjv2_host').addClass('warning');
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
$('#nmjv2_host').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testNMJv2-result').html(loading);
|
||||
$.get(sbRoot + '/home/testNMJv2', {'host': nmjv2_host})
|
||||
.done(function (data) {
|
||||
$('#testNMJv2-result').html(data);
|
||||
$('#testNMJv2').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testTrakt').click(function () {
|
||||
var trakt_api = $.trim($('#trakt_api').val());
|
||||
var trakt_username = $.trim($('#trakt_username').val());
|
||||
var trakt_password = $.trim($('#trakt_password').val());
|
||||
if (!trakt_api || !trakt_username || !trakt_password) {
|
||||
$('#testTrakt-result').html('Please fill out the necessary fields above.');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testNMJv2-result').html(loading);
|
||||
$.get(sbRoot + '/home/testNMJv2', {'host': nmjv2_host})
|
||||
.done(function (data) {
|
||||
$('#testNMJv2-result').html(data);
|
||||
$('#testNMJv2').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testTrakt').click(function () {
|
||||
var trakt_api = $.trim($('#trakt_api').val());
|
||||
var trakt_username = $.trim($('#trakt_username').val());
|
||||
var trakt_password = $.trim($('#trakt_password').val());
|
||||
if (!trakt_api || !trakt_username || !trakt_password) {
|
||||
$('#testTrakt-result').html('Please fill out the necessary fields above.');
|
||||
if (!trakt_api) {
|
||||
$('#trakt_api').addClass('warning');
|
||||
} else {
|
||||
|
@ -290,189 +274,189 @@ $(document).ready(function(){
|
|||
} else {
|
||||
$('#trakt_password').removeClass('warning');
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
$('#trakt_api,#trakt_username,#trakt_password').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testTrakt-result').html(loading);
|
||||
$.get(sbRoot + '/home/testTrakt', {'api': trakt_api, 'username': trakt_username, 'password': trakt_password})
|
||||
.done(function (data) {
|
||||
$('#testTrakt-result').html(data);
|
||||
$('#testTrakt').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testEmail').click(function () {
|
||||
var status, host, port, tls, from, user, pwd, err, to;
|
||||
status = $('#testEmail-result');
|
||||
status.html(loading);
|
||||
host = $('#email_host').val();
|
||||
host = host.length > 0 ? host : null;
|
||||
port = $('#email_port').val();
|
||||
port = port.length > 0 ? port : null;
|
||||
tls = $('#email_tls').attr('checked') !== undefined ? 1 : 0;
|
||||
from = $('#email_from').val();
|
||||
from = from.length > 0 ? from : 'root@localhost';
|
||||
user = $('#email_user').val().trim();
|
||||
pwd = $('#email_password').val();
|
||||
err = '';
|
||||
if (host === null) {
|
||||
err += '<li style="color: red;">You must specify an SMTP hostname!</li>';
|
||||
}
|
||||
if (port === null) {
|
||||
err += '<li style="color: red;">You must specify an SMTP port!</li>';
|
||||
} else if (port.match(/^\d+$/) === null || parseInt(port, 10) > 65535) {
|
||||
err += '<li style="color: red;">SMTP port must be between 0 and 65535!</li>';
|
||||
}
|
||||
if (err.length > 0) {
|
||||
err = '<ol>' + err + '</ol>';
|
||||
status.html(err);
|
||||
} else {
|
||||
to = prompt('Enter an email address to send the test to:', null);
|
||||
if (to === null || to.length === 0 || to.match(/.*@.*/) === null) {
|
||||
status.html('<p style="color: red;">You must provide a recipient email address!</p>');
|
||||
} else {
|
||||
$.get(sbRoot + '/home/testEmail', {host: host, port: port, smtp_from: from, use_tls: tls, user: user, pwd: pwd, to: to},
|
||||
function (msg) { $('#testEmail-result').html(msg); });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#testNMA').click(function () {
|
||||
var nma_api = $.trim($('#nma_api').val());
|
||||
var nma_priority = $('#nma_priority').val();
|
||||
if (!nma_api) {
|
||||
$('#testNMA-result').html('Please fill out the necessary fields above.');
|
||||
$('#nma_api').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#nma_api').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testNMA-result').html(loading);
|
||||
$.get(sbRoot + '/home/testNMA', {'nma_api': nma_api, 'nma_priority': nma_priority})
|
||||
.done(function (data) {
|
||||
$('#testNMA-result').html(data);
|
||||
$('#testNMA').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testPushalot').click(function () {
|
||||
var pushalot_authorizationtoken = $.trim($('#pushalot_authorizationtoken').val());
|
||||
if (!pushalot_authorizationtoken) {
|
||||
$('#testPushalot-result').html('Please fill out the necessary fields above.');
|
||||
$('#pushalot_authorizationtoken').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#pushalot_authorizationtoken').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testPushalot-result').html(loading);
|
||||
$.get(sbRoot + '/home/testPushalot', {'authorizationToken': pushalot_authorizationtoken})
|
||||
.done(function (data) {
|
||||
$('#testPushalot-result').html(data);
|
||||
$('#testPushalot').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testPushbullet').click(function () {
|
||||
var pushbullet_api = $.trim($('#pushbullet_api').val());
|
||||
if (!pushbullet_api) {
|
||||
$('#testPushbullet-result').html('Please fill out the necessary fields above.');
|
||||
$('#pushbullet_api').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#pushbullet_api').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testPushbullet-result').html(loading);
|
||||
$.get(sbRoot + '/home/testPushbullet', {'api': pushbullet_api})
|
||||
.done(function (data) {
|
||||
$('#testPushbullet-result').html(data);
|
||||
$('#testPushbullet').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
function get_pushbullet_devices(msg){
|
||||
|
||||
if(msg){
|
||||
$('#testPushbullet-result').html(loading);
|
||||
}
|
||||
|
||||
var pushbullet_api = $("#pushbullet_api").val();
|
||||
|
||||
if(!pushbullet_api) {
|
||||
$('#testPushbullet-result').html("You didn't supply a Pushbullet api key");
|
||||
$("#pushbullet_api").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var current_pushbullet_device = $("#pushbullet_device").val();
|
||||
$.get(sbRoot + "/home/getPushbulletDevices", {'api': pushbullet_api},
|
||||
function (data) {
|
||||
var devices = jQuery.parseJSON(data).devices;
|
||||
$("#pushbullet_device_list").html('');
|
||||
for (var i = 0; i < devices.length; i++) {
|
||||
if(devices[i].active == true) {
|
||||
if(current_pushbullet_device == devices[i].iden) {
|
||||
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'" selected>' + devices[i].nickname + '</option>')
|
||||
} else {
|
||||
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'">' + devices[i].nickname + '</option>')
|
||||
}
|
||||
}
|
||||
}
|
||||
if(msg) {
|
||||
$('#testPushbullet-result').html(msg);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$("#pushbullet_device_list").change(function(){
|
||||
$("#pushbullet_device").val($("#pushbullet_device_list").val());
|
||||
$('#testPushbullet-result').html("Don't forget to save your new pushbullet settings.");
|
||||
});
|
||||
};
|
||||
|
||||
$('#getPushbulletDevices').click(function(){
|
||||
get_pushbullet_devices("Device list updated. Please choose a device to push to.");
|
||||
});
|
||||
|
||||
// we have to call this function on dom ready to create the devices select
|
||||
get_pushbullet_devices();
|
||||
|
||||
$('#email_show').change(function () {
|
||||
var key = parseInt($('#email_show').val(), 10);
|
||||
$('#email_show_list').val(key >= 0 ? notify_data[key.toString()].list : '');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testTrakt-result').html(loading);
|
||||
$.get(sbRoot + '/home/testTrakt', {'api': trakt_api, 'username': trakt_username, 'password': trakt_password})
|
||||
.done(function (data) {
|
||||
$('#testTrakt-result').html(data);
|
||||
$('#testTrakt').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
// Update the internal data struct anytime settings are saved to the server
|
||||
$('#email_show').bind('notify', function () { load_show_notify_lists(); });
|
||||
$('#testEmail').click(function () {
|
||||
var status, host, port, tls, from, user, pwd, err, to;
|
||||
status = $('#testEmail-result');
|
||||
status.html(loading);
|
||||
host = $('#email_host').val();
|
||||
host = host.length > 0 ? host : null;
|
||||
port = $('#email_port').val();
|
||||
port = port.length > 0 ? port : null;
|
||||
tls = $('#email_tls').attr('checked') !== undefined ? 1 : 0;
|
||||
from = $('#email_from').val();
|
||||
from = from.length > 0 ? from : 'root@localhost';
|
||||
user = $('#email_user').val().trim();
|
||||
pwd = $('#email_password').val();
|
||||
err = '';
|
||||
if (host === null) {
|
||||
err += '<li style="color: red;">You must specify an SMTP hostname!</li>';
|
||||
}
|
||||
if (port === null) {
|
||||
err += '<li style="color: red;">You must specify an SMTP port!</li>';
|
||||
} else if (port.match(/^\d+$/) === null || parseInt(port, 10) > 65535) {
|
||||
err += '<li style="color: red;">SMTP port must be between 0 and 65535!</li>';
|
||||
}
|
||||
if (err.length > 0) {
|
||||
err = '<ol>' + err + '</ol>';
|
||||
status.html(err);
|
||||
} else {
|
||||
to = prompt('Enter an email address to send the test to:', null);
|
||||
if (to === null || to.length === 0 || to.match(/.*@.*/) === null) {
|
||||
status.html('<p style="color: red;">You must provide a recipient email address!</p>');
|
||||
} else {
|
||||
$.get(sbRoot + '/home/testEmail', {host: host, port: port, smtp_from: from, use_tls: tls, user: user, pwd: pwd, to: to},
|
||||
function (msg) { $('#testEmail-result').html(msg); });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function load_show_notify_lists() {
|
||||
$.get(sbRoot + "/home/loadShowNotifyLists", function (data) {
|
||||
var list, html, s;
|
||||
list = $.parseJSON(data);
|
||||
notify_data = list;
|
||||
if (list._size === 0) {
|
||||
return;
|
||||
}
|
||||
html = '<option value="-1">-- Select --</option>';
|
||||
for (s in list) {
|
||||
if (s.charAt(0) !== '_') {
|
||||
html += '<option value="' + list[s].id + '">' + $('<div/>').text(list[s].name).html() + '</option>';
|
||||
}
|
||||
}
|
||||
$('#email_show').html(html);
|
||||
$('#email_show_list').val('');
|
||||
});
|
||||
}
|
||||
// Load the per show notify lists everytime this page is loaded
|
||||
load_show_notify_lists();
|
||||
$('#testNMA').click(function () {
|
||||
var nma_api = $.trim($('#nma_api').val());
|
||||
var nma_priority = $('#nma_priority').val();
|
||||
if (!nma_api) {
|
||||
$('#testNMA-result').html('Please fill out the necessary fields above.');
|
||||
$('#nma_api').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#nma_api').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testNMA-result').html(loading);
|
||||
$.get(sbRoot + '/home/testNMA', {'nma_api': nma_api, 'nma_priority': nma_priority})
|
||||
.done(function (data) {
|
||||
$('#testNMA-result').html(data);
|
||||
$('#testNMA').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
// show instructions for plex when enabled
|
||||
$('#use_plex').click(function() {
|
||||
if ( $(this).is(':checked') ) {
|
||||
$('.plexinfo').removeClass('hide');
|
||||
} else {
|
||||
$('.plexinfo').addClass('hide');
|
||||
}
|
||||
});
|
||||
$('#testPushalot').click(function () {
|
||||
var pushalot_authorizationtoken = $.trim($('#pushalot_authorizationtoken').val());
|
||||
if (!pushalot_authorizationtoken) {
|
||||
$('#testPushalot-result').html('Please fill out the necessary fields above.');
|
||||
$('#pushalot_authorizationtoken').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#pushalot_authorizationtoken').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testPushalot-result').html(loading);
|
||||
$.get(sbRoot + '/home/testPushalot', {'authorizationToken': pushalot_authorizationtoken})
|
||||
.done(function (data) {
|
||||
$('#testPushalot-result').html(data);
|
||||
$('#testPushalot').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#testPushbullet').click(function () {
|
||||
var pushbullet_api = $.trim($('#pushbullet_api').val());
|
||||
if (!pushbullet_api) {
|
||||
$('#testPushbullet-result').html('Please fill out the necessary fields above.');
|
||||
$('#pushbullet_api').addClass('warning');
|
||||
return;
|
||||
}
|
||||
$('#pushbullet_api').removeClass('warning');
|
||||
$(this).prop('disabled', true);
|
||||
$('#testPushbullet-result').html(loading);
|
||||
$.get(sbRoot + '/home/testPushbullet', {'api': pushbullet_api})
|
||||
.done(function (data) {
|
||||
$('#testPushbullet-result').html(data);
|
||||
$('#testPushbullet').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
function get_pushbullet_devices(msg){
|
||||
|
||||
if(msg){
|
||||
$('#testPushbullet-result').html(loading);
|
||||
}
|
||||
|
||||
var pushbullet_api = $("#pushbullet_api").val();
|
||||
|
||||
if(!pushbullet_api) {
|
||||
$('#testPushbullet-result').html("You didn't supply a Pushbullet api key");
|
||||
$("#pushbullet_api").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var current_pushbullet_device = $("#pushbullet_device").val();
|
||||
$.get(sbRoot + "/home/getPushbulletDevices", {'api': pushbullet_api},
|
||||
function (data) {
|
||||
var devices = jQuery.parseJSON(data).devices;
|
||||
$("#pushbullet_device_list").html('');
|
||||
for (var i = 0; i < devices.length; i++) {
|
||||
if(devices[i].active == true) {
|
||||
if(current_pushbullet_device == devices[i].iden) {
|
||||
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'" selected>' + devices[i].nickname + '</option>')
|
||||
} else {
|
||||
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'">' + devices[i].nickname + '</option>')
|
||||
}
|
||||
}
|
||||
}
|
||||
if(msg) {
|
||||
$('#testPushbullet-result').html(msg);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$("#pushbullet_device_list").change(function(){
|
||||
$("#pushbullet_device").val($("#pushbullet_device_list").val());
|
||||
$('#testPushbullet-result').html("Don't forget to save your new pushbullet settings.");
|
||||
});
|
||||
};
|
||||
|
||||
$('#getPushbulletDevices').click(function(){
|
||||
get_pushbullet_devices("Device list updated. Please choose a device to push to.");
|
||||
});
|
||||
|
||||
// we have to call this function on dom ready to create the devices select
|
||||
get_pushbullet_devices();
|
||||
|
||||
$('#email_show').change(function () {
|
||||
var key = parseInt($('#email_show').val(), 10);
|
||||
$('#email_show_list').val(key >= 0 ? notify_data[key.toString()].list : '');
|
||||
});
|
||||
|
||||
// Update the internal data struct anytime settings are saved to the server
|
||||
$('#email_show').bind('notify', function () { load_show_notify_lists(); });
|
||||
|
||||
function load_show_notify_lists() {
|
||||
$.get(sbRoot + "/home/loadShowNotifyLists", function (data) {
|
||||
var list, html, s;
|
||||
list = $.parseJSON(data);
|
||||
notify_data = list;
|
||||
if (list._size === 0) {
|
||||
return;
|
||||
}
|
||||
html = '<option value="-1">-- Select --</option>';
|
||||
for (s in list) {
|
||||
if (s.charAt(0) !== '_') {
|
||||
html += '<option value="' + list[s].id + '">' + $('<div/>').text(list[s].name).html() + '</option>';
|
||||
}
|
||||
}
|
||||
$('#email_show').html(html);
|
||||
$('#email_show_list').val('');
|
||||
});
|
||||
}
|
||||
// Load the per show notify lists everytime this page is loaded
|
||||
load_show_notify_lists();
|
||||
|
||||
// show instructions for plex when enabled
|
||||
$('#use_plex').click(function() {
|
||||
if ( $(this).is(':checked') ) {
|
||||
$('.plexinfo').removeClass('hide');
|
||||
} else {
|
||||
$('.plexinfo').addClass('hide');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -309,19 +309,12 @@ 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
|
||||
BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD = False
|
||||
BOXCAR2_ACCESSTOKEN = None
|
||||
BOXCAR2_SOUND = None
|
||||
|
||||
USE_PUSHOVER = False
|
||||
PUSHOVER_NOTIFY_ONSNATCH = False
|
||||
|
@ -491,8 +484,7 @@ 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_BOXCAR2, BOXCAR2_ACCESSTOKEN, BOXCAR2_NOTIFY_ONDOWNLOAD, BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD, BOXCAR2_NOTIFY_ONSNATCH, BOXCAR2_SOUND, \
|
||||
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, \
|
||||
USE_SYNOLOGYNOTIFIER, SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH, SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD, SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD, \
|
||||
|
@ -521,7 +513,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,18 +784,13 @@ 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))
|
||||
BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD = bool(
|
||||
check_setting_int(CFG, 'Boxcar2', 'boxcar2_notify_onsubtitledownload', 0))
|
||||
BOXCAR2_ACCESSTOKEN = check_setting_str(CFG, 'Boxcar2', 'boxcar2_accesstoken', '')
|
||||
BOXCAR2_SOUND = check_setting_str(CFG, 'Boxcar2', 'boxcar2_sound', 'default')
|
||||
|
||||
USE_PUSHOVER = bool(check_setting_int(CFG, 'Pushover', 'use_pushover', 0))
|
||||
PUSHOVER_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Pushover', 'pushover_notify_onsnatch', 0))
|
||||
|
@ -1641,19 +1627,13 @@ 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)
|
||||
new_config['Boxcar2']['boxcar2_notify_ondownload'] = int(BOXCAR2_NOTIFY_ONDOWNLOAD)
|
||||
new_config['Boxcar2']['boxcar2_notify_onsubtitledownload'] = int(BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD)
|
||||
new_config['Boxcar2']['boxcar2_accesstoken'] = BOXCAR2_ACCESSTOKEN
|
||||
new_config['Boxcar2']['boxcar2_sound'] = BOXCAR2_SOUND
|
||||
|
||||
new_config['Pushover'] = {}
|
||||
new_config['Pushover']['use_pushover'] = int(USE_PUSHOVER)
|
||||
|
|
|
@ -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
|
|
@ -18,7 +18,8 @@
|
|||
# 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 urllib
|
||||
import urllib2
|
||||
import time
|
||||
|
||||
import sickbeard
|
||||
|
@ -27,103 +28,105 @@ 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://new.boxcar.io/api/notifications"
|
||||
API_URL = 'https://new.boxcar.io/api/notifications'
|
||||
|
||||
|
||||
class Boxcar2Notifier:
|
||||
def test_notify(self, accesstoken, title="SickGear : Test"):
|
||||
return self._sendBoxcar2("This is a test notification from SickGear", title, accesstoken)
|
||||
|
||||
def _sendBoxcar2(self, msg, title, accesstoken):
|
||||
def _sendBoxcar2(self, title, msg, accesstoken, sound):
|
||||
"""
|
||||
Sends a boxcar2 notification to the address provided
|
||||
|
||||
msg: The message to send
|
||||
title: The title of the message
|
||||
accesstoken: to send to this device
|
||||
|
||||
|
||||
returns: True if the message succeeded, False otherwise
|
||||
"""
|
||||
|
||||
# build up the URL and parameters
|
||||
#more info goes here - https://boxcar.uservoice.com/knowledgebase/articles/306788-how-to-send-your-boxcar-account-a-notification
|
||||
msg = msg.strip()
|
||||
curUrl = API_URL
|
||||
# more info goes here - https://boxcar.uservoice.com/knowledgebase/articles/306788-how-to-send-your-boxcar-account-a-notification
|
||||
msg = msg.strip().encode('utf-8')
|
||||
|
||||
data = urllib.urlencode({
|
||||
'user_credentials': accesstoken,
|
||||
'notification[title]': "SickGear : " + title + ' : ' + msg,
|
||||
'notification[title]': title + ' - ' + msg,
|
||||
'notification[long_message]': msg,
|
||||
'notification[sound]': "notifier-2"
|
||||
'notification[sound]': sound,
|
||||
'notification[source_name]': 'SickGear',
|
||||
'notification[icon_url]': 'https://cdn.rawgit.com/SickGear/SickGear/master/gui/slick/images/ico/apple-touch-icon-60x60.png'
|
||||
})
|
||||
|
||||
# send the request to boxcar2
|
||||
try:
|
||||
req = urllib2.Request(curUrl)
|
||||
req = urllib2.Request(API_URL)
|
||||
handle = urllib2.urlopen(req, data)
|
||||
handle.close()
|
||||
|
||||
except urllib2.HTTPError, e:
|
||||
except urllib2.URLError, 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("Boxcar2 notification failed." + ex(e), logger.ERROR)
|
||||
return False
|
||||
logger.log(u'BOXCAR2: Notification failed.' + ex(e), logger.ERROR)
|
||||
else:
|
||||
logger.log("Boxcar2 notification failed. Error code: " + str(e.code), logger.WARNING)
|
||||
logger.log(u'BOXCAR2: Notification failed. Error code: ' + str(e.code), logger.ERROR)
|
||||
|
||||
# HTTP status 404
|
||||
if e.code == 404:
|
||||
logger.log("Access token is invalid. Check it.", logger.WARNING)
|
||||
return False
|
||||
|
||||
# If you receive an HTTP status code of 400, it is because you failed to send the proper parameters
|
||||
logger.log(u'BOXCAR2: Access token is wrong/not associated to a device.', logger.ERROR)
|
||||
elif e.code == 401:
|
||||
logger.log(u'BOXCAR2: Access token not recognized.', logger.ERROR)
|
||||
elif e.code == 400:
|
||||
logger.log("Wrong data sent to boxcar2", logger.ERROR)
|
||||
return False
|
||||
logger.log(u'BOXCAR2: Wrong data sent to boxcar.', logger.ERROR)
|
||||
elif e.code == 503:
|
||||
logger.log(u'BOXCAR2: Boxcar server to busy to handle the request at this time.', logger.WARNING)
|
||||
return False
|
||||
|
||||
logger.log("Boxcar2 notification successful.", logger.DEBUG)
|
||||
logger.log(u'BOXCAR2: Notification successful.', logger.MESSAGE)
|
||||
return True
|
||||
|
||||
def notify_snatch(self, ep_name, title=notifyStrings[NOTIFY_SNATCH]):
|
||||
def _notifyBoxcar2(self, title, message, accesstoken=None, sound=None, force=False):
|
||||
"""
|
||||
Sends a boxcar2 notification based on the provided info or SG config
|
||||
|
||||
title: The title of the notification to send
|
||||
message: The message string to send
|
||||
accesstoken: to send to this device
|
||||
force: If True then the notification will be sent even if Boxcar is disabled in the config
|
||||
"""
|
||||
|
||||
# suppress notifications if the notifier is disabled but the notify options are checked
|
||||
if not sickbeard.USE_BOXCAR2 and not force:
|
||||
logger.log(u'BOXCAR2: Notifications are not enabled, skipping this notification', logger.DEBUG)
|
||||
return False
|
||||
|
||||
# fill in omitted parameters
|
||||
if not accesstoken:
|
||||
accesstoken = sickbeard.BOXCAR2_ACCESSTOKEN
|
||||
if not sound:
|
||||
sound = sickbeard.BOXCAR2_SOUND
|
||||
|
||||
logger.log(u'BOXCAR2: Sending notification for ' + message, logger.DEBUG)
|
||||
|
||||
self._sendBoxcar2(title, message, accesstoken, sound)
|
||||
return True
|
||||
|
||||
def test_notify(self, accesstoken, sound, force=True):
|
||||
return self._sendBoxcar2('Test', 'This is a test notification from SickGear', accesstoken, sound)
|
||||
|
||||
def notify_snatch(self, ep_name):
|
||||
if sickbeard.BOXCAR2_NOTIFY_ONSNATCH:
|
||||
self._notifyBoxcar2(title, ep_name)
|
||||
self._notifyBoxcar2(notifyStrings[NOTIFY_SNATCH], ep_name)
|
||||
|
||||
|
||||
def notify_download(self, ep_name, title=notifyStrings[NOTIFY_DOWNLOAD]):
|
||||
def notify_download(self, ep_name):
|
||||
if sickbeard.BOXCAR2_NOTIFY_ONDOWNLOAD:
|
||||
self._notifyBoxcar2(title, ep_name)
|
||||
self._notifyBoxcar2(notifyStrings[NOTIFY_DOWNLOAD], ep_name)
|
||||
|
||||
def notify_subtitle_download(self, ep_name, lang, title=notifyStrings[NOTIFY_SUBTITLE_DOWNLOAD]):
|
||||
def notify_subtitle_download(self, ep_name, lang):
|
||||
if sickbeard.BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD:
|
||||
self._notifyBoxcar2(title, ep_name + ": " + lang)
|
||||
self._notifyBoxcar2(notifyStrings[NOTIFY_SUBTITLE_DOWNLOAD], ep_name + ': ' + lang)
|
||||
|
||||
def notify_git_update(self, new_version = "??"):
|
||||
def notify_git_update(self, new_version = '??'):
|
||||
if sickbeard.USE_BOXCAR2:
|
||||
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):
|
||||
"""
|
||||
Sends a boxcar2 notification based on the provided info or SB config
|
||||
|
||||
title: The title of the notification to send
|
||||
message: The message string to send
|
||||
accesstoken: to send to this device
|
||||
"""
|
||||
|
||||
if not sickbeard.USE_BOXCAR2:
|
||||
logger.log("Notification for Boxcar2 not enabled, skipping this notification", logger.DEBUG)
|
||||
return False
|
||||
|
||||
# if no username was given then use the one from the config
|
||||
if not accesstoken:
|
||||
accesstoken = sickbeard.BOXCAR2_ACCESSTOKEN
|
||||
|
||||
logger.log("Sending notification for " + message, logger.DEBUG)
|
||||
|
||||
self._sendBoxcar2(message, title, accesstoken)
|
||||
return True
|
||||
|
||||
|
||||
notifier = Boxcar2Notifier
|
||||
|
|
|
@ -2344,10 +2344,8 @@ 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,
|
||||
boxcar2_notify_onsubtitledownload=None, boxcar2_accesstoken=None, boxcar2_sound=None,
|
||||
use_pushover=None, pushover_notify_onsnatch=None, pushover_notify_ondownload=None,
|
||||
pushover_notify_onsubtitledownload=None, pushover_userkey=None, pushover_apikey=None,
|
||||
use_libnotify=None, libnotify_notify_onsnatch=None, libnotify_notify_ondownload=None,
|
||||
|
@ -2418,17 +2416,12 @@ 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)
|
||||
sickbeard.BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(boxcar2_notify_onsubtitledownload)
|
||||
sickbeard.BOXCAR2_ACCESSTOKEN = boxcar2_accesstoken
|
||||
sickbeard.BOXCAR2_SOUND = boxcar2_sound
|
||||
|
||||
sickbeard.USE_PUSHOVER = config.checkbox_to_value(use_pushover)
|
||||
sickbeard.PUSHOVER_NOTIFY_ONSNATCH = config.checkbox_to_value(pushover_notify_onsnatch)
|
||||
|
@ -3357,20 +3350,10 @@ class Home(MainHandler):
|
|||
return "Test prowl notice failed"
|
||||
|
||||
|
||||
def testBoxcar(self, username=None):
|
||||
def testBoxcar2(self, accesstoken=None, sound=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')
|
||||
|
||||
result = notifiers.boxcar2_notifier.test_notify(accesstoken)
|
||||
result = notifiers.boxcar2_notifier.test_notify(accesstoken, sound)
|
||||
if result:
|
||||
return "Boxcar2 notification succeeded. Check your Boxcar2 clients to make sure it worked"
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue