2012-01-05 05:19:02 +03:00
|
|
|
$('#SeriesName').live('change', function () { createExamples(); });
|
|
|
|
$('#EpisodeName').live('change', function () { createExamples(); });
|
|
|
|
$('#ReplaceSpaces').live('change', function () { createExamples(); });
|
|
|
|
$('#AppendQuality').live('change', function () { createExamples(); });
|
|
|
|
$('#SeparatorStyle').live('change', function () { createExamples(); });
|
|
|
|
$('#NumberStyle').live('change', function () { createExamples(); });
|
|
|
|
$('#MultiEpisodeStyle').live('change', function () { createExamples(); });
|
|
|
|
|
2012-03-18 07:14:32 +03:00
|
|
|
var testProwlUrl = '../Command/TestProwl';
|
|
|
|
var testSabUrl = '../Command/TestSabnzbd';
|
2013-01-24 10:31:41 +03:00
|
|
|
var testNzbgetUrl = '../Command/TestNzbget';
|
2012-04-05 01:29:55 +03:00
|
|
|
var testEmailUrl = '../Command/TestEmail';
|
2012-10-22 06:44:16 +03:00
|
|
|
var testXbmcNotificationUrl = '../Command/TestXbmcNotification';
|
|
|
|
var testXbmcJsonApiUrl = '../Command/TestXbmcJsonApi';
|
2012-10-22 07:29:12 +03:00
|
|
|
var testPlexNotificationUrl = '../Command/TestPlexNotification';
|
|
|
|
var testPlexServerUrl = '../Command/TestPlexServer';
|
2012-03-18 07:14:32 +03:00
|
|
|
|
2012-01-05 05:19:02 +03:00
|
|
|
function createExamples() {
|
|
|
|
createSingleEpisodeExample();
|
|
|
|
createMultiEpisodeExample();
|
|
|
|
}
|
|
|
|
|
|
|
|
function createSingleEpisodeExample() {
|
|
|
|
var result = '';
|
|
|
|
|
|
|
|
var separator = ' - ';
|
|
|
|
|
|
|
|
if ($("#SeparatorStyle option:selected").val() == 1)
|
|
|
|
separator = ' ';
|
2012-04-15 03:17:36 +03:00
|
|
|
|
|
|
|
if ($("#SeparatorStyle option:selected").val() == 2)
|
|
|
|
separator = '.';
|
2012-01-05 05:19:02 +03:00
|
|
|
|
|
|
|
if ($('#SeriesName').attr('checked')) {
|
|
|
|
result += 'Series Name';
|
|
|
|
result += separator;
|
|
|
|
}
|
|
|
|
|
|
|
|
result += $("#NumberStyle option:selected").text();
|
|
|
|
|
|
|
|
if ($('#EpisodeName').attr('checked')) {
|
|
|
|
result += separator;
|
|
|
|
result += 'Episode Name';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($('#AppendQuality').attr('checked'))
|
|
|
|
result += ' [TV]';
|
|
|
|
|
|
|
|
if ($('#ReplaceSpaces').attr('checked'))
|
|
|
|
result = result.replace(/\s/g, '.');
|
|
|
|
|
|
|
|
$('#singleEpisodeExample').children('.result').text(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
function createMultiEpisodeExample() {
|
|
|
|
var result = '';
|
|
|
|
|
|
|
|
var separator = ' - ';
|
|
|
|
|
|
|
|
if ($("#SeparatorStyle option:selected").val() == 1)
|
|
|
|
separator = ' ';
|
2012-04-15 03:17:36 +03:00
|
|
|
|
|
|
|
if ($("#SeparatorStyle option:selected").val() == 2)
|
|
|
|
separator = '.';
|
2012-01-05 05:19:02 +03:00
|
|
|
|
|
|
|
if ($('#SeriesName').attr('checked')) {
|
|
|
|
result += 'Series Name';
|
|
|
|
result += separator;
|
|
|
|
}
|
|
|
|
|
|
|
|
var numberStyle = $("#NumberStyle option:selected").text();
|
|
|
|
var numberId = $("#NumberStyle option:selected").val();
|
|
|
|
var style = $("#MultiEpisodeStyle option:selected").val();
|
|
|
|
|
|
|
|
result += numberStyle;
|
|
|
|
|
|
|
|
if (style == 0)
|
|
|
|
result += '-06';
|
|
|
|
|
|
|
|
if (style == 1) {
|
|
|
|
result += separator;
|
|
|
|
result += numberStyle.replace('5', '6');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (style == 2) {
|
|
|
|
if (numberId <= 1)
|
|
|
|
result += 'x06';
|
|
|
|
|
|
|
|
if (numberId == 2)
|
|
|
|
result += 'E06';
|
|
|
|
|
|
|
|
if (numberId == 3)
|
|
|
|
result += 'e06';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (style == 3) {
|
|
|
|
if (numberId <= 1)
|
|
|
|
result += '-x06';
|
|
|
|
|
|
|
|
if (numberId == 2)
|
|
|
|
result += '-E06';
|
|
|
|
|
|
|
|
if (numberId == 3)
|
|
|
|
result += '-e06';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($('#EpisodeName').attr('checked')) {
|
|
|
|
result += separator;
|
|
|
|
result += 'Episode Name';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($('#AppendQuality').attr('checked'))
|
|
|
|
result += ' [TV]';
|
|
|
|
|
|
|
|
if ($('#ReplaceSpaces').attr('checked'))
|
|
|
|
result = result.replace(/\s/g, '.');
|
|
|
|
|
|
|
|
$('#multiEpisodeExample').children('.result').text(result);
|
2012-03-18 07:14:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function testProwl(event) {
|
|
|
|
var apiKeys = $('#ProwlApiKeys').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: testProwlUrl,
|
|
|
|
data: jQuery.param({ apiKeys: apiKeys })
|
|
|
|
});
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
function testSabnzbd(event) {
|
|
|
|
var host = $('#SabHost').val();
|
|
|
|
var port = $('#SabPort').val();
|
|
|
|
var apiKey = $('#SabApiKey').val();
|
|
|
|
var username = $('#SabUsername').val();
|
|
|
|
var password = $('#SabPassword').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: testSabUrl,
|
|
|
|
data: jQuery.param({ host: host, port: port, apiKey: apiKey, username: username, password: password })
|
|
|
|
});
|
|
|
|
|
|
|
|
event.preventDefault();
|
2012-04-05 01:29:55 +03:00
|
|
|
}
|
|
|
|
|
2013-01-24 10:31:41 +03:00
|
|
|
function testNzbget() {
|
|
|
|
var host = $('#NzbgetHost').val();
|
|
|
|
var port = $('#NzbgetPort').val();
|
|
|
|
var username = $('#NzbgetUsername').val();
|
|
|
|
var password = $('#NzbgetPassword').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: testNzbgetUrl,
|
|
|
|
data: jQuery.param({ host: host, port: port, username: username, password: password })
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-04-05 01:29:55 +03:00
|
|
|
//Twitter
|
|
|
|
getAuthorizationUrl = '../Command/GetTwitterAuthorization';
|
|
|
|
verifyAuthorizationUrl = '../Command/VerifyTwitterAuthorization';
|
|
|
|
|
|
|
|
function requestTwitterAuthorization() {
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: getAuthorizationUrl,
|
|
|
|
error: function (req, status, error) {
|
|
|
|
alert("Sorry! We could get Twitter Authorization at this time. " + error);
|
|
|
|
},
|
|
|
|
success: function (data, textStatus, jqXHR) {
|
|
|
|
if (data.IsMessage)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
$('#authorizationRequestToken').val(data.Token);
|
|
|
|
window.open(data.Url);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function verifyTwitterAuthorization() {
|
|
|
|
var token = $('#authorizationRequestToken').val();
|
|
|
|
var verifier = $('#twitterVerification').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: verifyAuthorizationUrl,
|
|
|
|
data: jQuery.param({ token: token, verifier: verifier }),
|
|
|
|
error: function (req, status, error) {
|
|
|
|
alert("Sorry! We could verify Twitter Authorization at this time. " + error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//SMTP
|
|
|
|
function testSmtpSettings() {
|
|
|
|
//Get the variables
|
|
|
|
var server = $('#SmtpServer').val();
|
|
|
|
var port = $('#SmtpPort').val();
|
2012-05-14 21:13:19 +03:00
|
|
|
var ssl = $('#SmtpUseSsl').prop('checked');
|
2012-04-05 01:29:55 +03:00
|
|
|
var username = $('#SmtpUsername').val();
|
|
|
|
var password = $('#SmtpPassword').val();
|
|
|
|
var fromAddress = $('#SmtpFromAddress').val();
|
|
|
|
var toAddresses = $('#SmtpToAddresses').val();
|
|
|
|
|
|
|
|
//Send the data!
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: testEmailUrl,
|
|
|
|
data: jQuery.param({
|
|
|
|
server: server,
|
|
|
|
port: port,
|
|
|
|
ssl: ssl,
|
|
|
|
username: username,
|
|
|
|
password: password,
|
|
|
|
fromAddress: fromAddress,
|
|
|
|
toAddresses: toAddresses
|
2012-10-22 06:44:16 +03:00
|
|
|
})
|
2012-04-05 01:29:55 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Growl
|
|
|
|
function registerGrowl() {
|
|
|
|
//Get the variables
|
|
|
|
var host = $('#GrowlHost').val();
|
|
|
|
var password = $('#GrowlPassword').val();
|
|
|
|
|
|
|
|
//Send the data!
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: '../Command/RegisterGrowl',
|
|
|
|
data: jQuery.param({
|
|
|
|
host: host,
|
|
|
|
password: password
|
2012-10-22 06:44:16 +03:00
|
|
|
})
|
2012-04-05 01:29:55 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
return false;
|
2012-10-22 06:44:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//XBMC
|
|
|
|
$(document).on('click', '#xbmc-test-notification', function() {
|
|
|
|
var hosts = $('#XbmcHosts').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: testXbmcNotificationUrl,
|
|
|
|
data: jQuery.param({ hosts: hosts })
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on('click', '#xbmc-test-jsonapi', function () {
|
|
|
|
var hosts = $('#XbmcHosts').val();
|
|
|
|
var username = $('#XbmcUsername').val();
|
|
|
|
var password = $('#XbmcPassword').val();
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: testXbmcJsonApiUrl,
|
|
|
|
data: jQuery.param({
|
|
|
|
hosts: hosts,
|
|
|
|
username: username,
|
|
|
|
password: password
|
|
|
|
})
|
|
|
|
});
|
2012-10-22 07:29:12 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
//Plex
|
|
|
|
$(document).on('click', '#plex-test-notification', function () {
|
|
|
|
var hosts = $('#PlexsClientHosts').val();
|
|
|
|
var username = $('#PlexUsername').val();
|
|
|
|
var password = $('#PlexPassword').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: testPlexNotificationUrl,
|
|
|
|
data: jQuery.param({
|
|
|
|
hosts: hosts,
|
|
|
|
username: username,
|
|
|
|
password: password
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on('click', '#plex-test-server', function () {
|
|
|
|
var host = $('#PlexServerHost').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: testPlexServerUrl,
|
|
|
|
data: jQuery.param({
|
|
|
|
host: host
|
|
|
|
})
|
|
|
|
});
|
2012-10-22 06:44:16 +03:00
|
|
|
});
|