remodel config to match jellyfin purpose
This commit is contained in:
@@ -89,14 +89,14 @@ select.form-control {
|
||||
margin-bottom: 4px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.selectize-control.form-control.selectize-pms-ip .selectize-input {
|
||||
.selectize-control.form-control.selectize-jellyfin-ip .selectize-input {
|
||||
padding-left: 12px !important;
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
min-height: 32px !important;
|
||||
height: 32px !important;
|
||||
}
|
||||
.input-group .selectize-control.form-control.selectize-pms-ip .selectize-input > div {
|
||||
.input-group .selectize-control.form-control.selectize-jellyfin-ip .selectize-input > div {
|
||||
max-width: 450px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -104,18 +104,18 @@ select.form-control {
|
||||
.wizard-input-section p.welcome-message {
|
||||
margin: 20px 0;
|
||||
}
|
||||
.wizard-input-section .selectize-control.form-control.selectize-pms-ip .selectize-input > div {
|
||||
.wizard-input-section .selectize-control.form-control.selectize-jellyfin-ip .selectize-input > div {
|
||||
max-width: 360px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
#selectize-pms-ip-container .selectize-dropdown.form-control.selectize-pms-ip {
|
||||
#selectize-jellyfin-ip-container .selectize-dropdown.form-control.selectize-jellyfin-ip {
|
||||
margin-left: 15px;
|
||||
}
|
||||
.wizard-input-section .selectize-control.form-control.selectize-pms-ip .selectize-dropdown .selectize-dropdown-content {
|
||||
.wizard-input-section .selectize-control.form-control.selectize-jellyfin-ip .selectize-dropdown .selectize-dropdown-content {
|
||||
max-height: 150px;
|
||||
}
|
||||
.wizard-input-section .selectize-dropdown.form-control.selectize-pms-ip {
|
||||
.wizard-input-section .selectize-dropdown.form-control.selectize-jellyfin-ip {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
#condition-widget .fa-plus,
|
||||
|
@@ -145,7 +145,7 @@ function doAjaxCall(url, elem, reload, form, showMsg, callback) {
|
||||
dataString = $(formID).serialize();
|
||||
}
|
||||
// Loader Image
|
||||
var loader = $("<div class='msg ajaxLoader-" + url +"'><i class='fa fa-refresh fa-spin'></i> Saving...</div>");
|
||||
var loader = $("<div class='msg ajaxLoader-" + url + "'><i class='fa fa-refresh fa-spin'></i> Saving...</div>");
|
||||
// Data Success Message
|
||||
var dataSucces = $(elem).data('success');
|
||||
if (typeof dataSucces === "undefined") {
|
||||
@@ -248,10 +248,10 @@ getBrowsePath = function (key, path, filter_ext) {
|
||||
path: path,
|
||||
filter_ext: filter_ext
|
||||
},
|
||||
success: function(data) {
|
||||
success: function (data) {
|
||||
deferred.resolve(data);
|
||||
},
|
||||
error: function() {
|
||||
error: function () {
|
||||
deferred.reject();
|
||||
}
|
||||
});
|
||||
@@ -350,13 +350,13 @@ function getPercent(value1, value2) {
|
||||
|
||||
function millisecondsToMinutes(ms, roundToMinute) {
|
||||
if (ms > 0) {
|
||||
var minutes = Math.floor(ms / 60000);
|
||||
var seconds = ((ms % 60000) / 1000).toFixed(0);
|
||||
if (roundToMinute) {
|
||||
return (seconds >= 30 ? (minutes + 1) : minutes);
|
||||
} else {
|
||||
return (seconds == 60 ? (minutes + 1) + ":00" : minutes + ":" + (seconds < 10 ? "0" : "") + seconds);
|
||||
}
|
||||
var minutes = Math.floor(ms / 60000);
|
||||
var seconds = ((ms % 60000) / 1000).toFixed(0);
|
||||
if (roundToMinute) {
|
||||
return (seconds >= 30 ? (minutes + 1) : minutes);
|
||||
} else {
|
||||
return (seconds == 60 ? (minutes + 1) + ":00" : minutes + ":" + (seconds < 10 ? "0" : "") + seconds);
|
||||
}
|
||||
} else {
|
||||
if (roundToMinute) {
|
||||
return '0';
|
||||
@@ -366,7 +366,7 @@ function millisecondsToMinutes(ms, roundToMinute) {
|
||||
}
|
||||
}
|
||||
|
||||
function humanDuration(ms, sig='dhm', units='ms', return_seconds=300000) {
|
||||
function humanDuration(ms, sig = 'dhm', units = 'ms', return_seconds = 300000) {
|
||||
var factors = {
|
||||
d: 86400000,
|
||||
h: 3600000,
|
||||
@@ -385,7 +385,7 @@ function humanDuration(ms, sig='dhm', units='ms', return_seconds=300000) {
|
||||
|
||||
ms = ms * factors[units];
|
||||
|
||||
h = ms % factors['d'];
|
||||
h = ms % factors['d'];
|
||||
d = Math.trunc(ms / factors['d']);
|
||||
|
||||
m = h % factors['h'];
|
||||
@@ -460,6 +460,7 @@ function getCookie(cname) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
var Accordion = function (el, multiple, close) {
|
||||
this.el = el || {};
|
||||
this.multiple = multiple || false;
|
||||
@@ -496,6 +497,7 @@ function clearSearchButton(tableName, table) {
|
||||
table.search('').draw();
|
||||
});
|
||||
}
|
||||
|
||||
// Taken from https://github.com/Hellowlol/HTPC-Manager
|
||||
window.onerror = function (message, file, line) {
|
||||
var e = {
|
||||
@@ -504,7 +506,8 @@ window.onerror = function (message, file, line) {
|
||||
'file': file,
|
||||
'line': line
|
||||
};
|
||||
$.post("log_js_errors", e, function (data) { });
|
||||
$.post("log_js_errors", e, function (data) {
|
||||
});
|
||||
};
|
||||
|
||||
$('*').on('click', '.refresh_pms_image', function (e) {
|
||||
@@ -554,14 +557,11 @@ function forceMinMax(elem) {
|
||||
var default_val = parseInt(elem.data('default'));
|
||||
if (isNaN(val)) {
|
||||
elem.val(default_val);
|
||||
}
|
||||
else if (min !== undefined && val < min) {
|
||||
} else if (min !== undefined && val < min) {
|
||||
elem.val(min);
|
||||
}
|
||||
else if (max !== undefined && val > max) {
|
||||
} else if (max !== undefined && val > max) {
|
||||
elem.val(max);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
elem.val(val);
|
||||
}
|
||||
}
|
||||
@@ -570,14 +570,14 @@ function capitalizeFirstLetter(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
$.fn.slideToggleBool = function(bool, options) {
|
||||
return bool ? $(this).slideDown(options) : $(this).slideUp(options);
|
||||
$.fn.slideToggleBool = function (bool, options) {
|
||||
return bool ? $(this).slideDown(options) : $(this).slideUp(options);
|
||||
};
|
||||
|
||||
function openPlexXML(endpoint, plextv, params) {
|
||||
var data = $.extend({endpoint: endpoint, plextv: plextv}, params);
|
||||
$.getJSON('return_plex_xml_url', data, function(xml_url) {
|
||||
window.open(xml_url, '_blank');
|
||||
$.getJSON('return_plex_xml_url', data, function (xml_url) {
|
||||
window.open(xml_url, '_blank');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -609,6 +609,7 @@ function setLocalStorage(key, value, path) {
|
||||
}
|
||||
localStorage.setItem(key_path, value);
|
||||
}
|
||||
|
||||
function getLocalStorage(key, default_value, path) {
|
||||
var key_path = key;
|
||||
if (path !== false) {
|
||||
@@ -624,7 +625,7 @@ function getLocalStorage(key, default_value, path) {
|
||||
}
|
||||
|
||||
function uuidv4() {
|
||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, function(c) {
|
||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
|
||||
var cryptoObj = window.crypto || window.msCrypto; // for IE 11
|
||||
return (c ^ cryptoObj.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||
});
|
||||
@@ -648,44 +649,44 @@ function getPlexHeaders() {
|
||||
|
||||
var plex_oauth_window = null;
|
||||
const plex_oauth_loader = '<style>' +
|
||||
'.login-loader-container {' +
|
||||
'font-family: "Open Sans", Arial, sans-serif;' +
|
||||
'position: absolute;' +
|
||||
'top: 0;' +
|
||||
'right: 0;' +
|
||||
'bottom: 0;' +
|
||||
'left: 0;' +
|
||||
'}' +
|
||||
'.login-loader-message {' +
|
||||
'color: #282A2D;' +
|
||||
'text-align: center;' +
|
||||
'position: absolute;' +
|
||||
'left: 50%;' +
|
||||
'top: 25%;' +
|
||||
'transform: translate(-50%, -50%);' +
|
||||
'}' +
|
||||
'.login-loader {' +
|
||||
'border: 5px solid #ccc;' +
|
||||
'-webkit-animation: spin 1s linear infinite;' +
|
||||
'animation: spin 1s linear infinite;' +
|
||||
'border-top: 5px solid #282A2D;' +
|
||||
'border-radius: 50%;' +
|
||||
'width: 50px;' +
|
||||
'height: 50px;' +
|
||||
'position: relative;' +
|
||||
'left: calc(50% - 25px);' +
|
||||
'}' +
|
||||
'@keyframes spin {' +
|
||||
'0% { transform: rotate(0deg); }' +
|
||||
'100% { transform: rotate(360deg); }' +
|
||||
'}' +
|
||||
'.login-loader-container {' +
|
||||
'font-family: "Open Sans", Arial, sans-serif;' +
|
||||
'position: absolute;' +
|
||||
'top: 0;' +
|
||||
'right: 0;' +
|
||||
'bottom: 0;' +
|
||||
'left: 0;' +
|
||||
'}' +
|
||||
'.login-loader-message {' +
|
||||
'color: #282A2D;' +
|
||||
'text-align: center;' +
|
||||
'position: absolute;' +
|
||||
'left: 50%;' +
|
||||
'top: 25%;' +
|
||||
'transform: translate(-50%, -50%);' +
|
||||
'}' +
|
||||
'.login-loader {' +
|
||||
'border: 5px solid #ccc;' +
|
||||
'-webkit-animation: spin 1s linear infinite;' +
|
||||
'animation: spin 1s linear infinite;' +
|
||||
'border-top: 5px solid #282A2D;' +
|
||||
'border-radius: 50%;' +
|
||||
'width: 50px;' +
|
||||
'height: 50px;' +
|
||||
'position: relative;' +
|
||||
'left: calc(50% - 25px);' +
|
||||
'}' +
|
||||
'@keyframes spin {' +
|
||||
'0% { transform: rotate(0deg); }' +
|
||||
'100% { transform: rotate(360deg); }' +
|
||||
'}' +
|
||||
'</style>' +
|
||||
'<div class="login-loader-container">' +
|
||||
'<div class="login-loader-message">' +
|
||||
'<div class="login-loader"></div>' +
|
||||
'<br>' +
|
||||
'Redirecting to the Plex login page...' +
|
||||
'</div>' +
|
||||
'<div class="login-loader-message">' +
|
||||
'<div class="login-loader"></div>' +
|
||||
'<br>' +
|
||||
'Redirecting to the Plex login page...' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
function closePlexOAuthWindow() {
|
||||
@@ -702,10 +703,10 @@ getPlexOAuthPin = function () {
|
||||
url: 'https://plex.tv/api/v2/pins?strong=true',
|
||||
type: 'POST',
|
||||
headers: x_plex_headers,
|
||||
success: function(data) {
|
||||
success: function (data) {
|
||||
deferred.resolve({pin: data.id, code: data.code});
|
||||
},
|
||||
error: function() {
|
||||
error: function () {
|
||||
closePlexOAuthWindow();
|
||||
deferred.reject();
|
||||
}
|
||||
@@ -751,7 +752,7 @@ function PlexOAuth(success, error, pre) {
|
||||
type: 'GET',
|
||||
headers: x_plex_headers,
|
||||
success: function (data) {
|
||||
if (data.authToken){
|
||||
if (data.authToken) {
|
||||
closePlexOAuthWindow();
|
||||
if (typeof success === "function") {
|
||||
success(data.authToken)
|
||||
@@ -767,8 +768,10 @@ function PlexOAuth(success, error, pre) {
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
if (!plex_oauth_window.closed && polling === pin){
|
||||
setTimeout(function() {poll()}, 1000);
|
||||
if (!plex_oauth_window.closed && polling === pin) {
|
||||
setTimeout(function () {
|
||||
poll()
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
timeout: 10000
|
||||
@@ -783,7 +786,7 @@ function PlexOAuth(success, error, pre) {
|
||||
}
|
||||
|
||||
function encodeData(data) {
|
||||
return Object.keys(data).map(function(key) {
|
||||
return Object.keys(data).map(function (key) {
|
||||
return [key, data[key]].map(encodeURIComponent).join("=");
|
||||
}).join("&");
|
||||
}
|
||||
@@ -808,17 +811,39 @@ function page(endpoint, ...args) {
|
||||
function pms_image_proxy(img, rating_key, width, height, opacity, background, blur, fallback, refresh, clip, img_format) {
|
||||
var params = {};
|
||||
|
||||
if (img != null) { params.img = img; }
|
||||
if (rating_key != null) { params.rating_key = rating_key; }
|
||||
if (width != null) { params.width = width; }
|
||||
if (height != null) { params.height = height; }
|
||||
if (opacity != null) { params.opacity = opacity; }
|
||||
if (background != null) { params.background = background; }
|
||||
if (blur != null) { params.blur = blur; }
|
||||
if (fallback != null) { params.fallback = fallback; }
|
||||
if (refresh != null) { params.refresh = true; }
|
||||
if (clip != null) { params.clip = true; }
|
||||
if (img_format != null) { params.img_format = img_format; }
|
||||
if (img != null) {
|
||||
params.img = img;
|
||||
}
|
||||
if (rating_key != null) {
|
||||
params.rating_key = rating_key;
|
||||
}
|
||||
if (width != null) {
|
||||
params.width = width;
|
||||
}
|
||||
if (height != null) {
|
||||
params.height = height;
|
||||
}
|
||||
if (opacity != null) {
|
||||
params.opacity = opacity;
|
||||
}
|
||||
if (background != null) {
|
||||
params.background = background;
|
||||
}
|
||||
if (blur != null) {
|
||||
params.blur = blur;
|
||||
}
|
||||
if (fallback != null) {
|
||||
params.fallback = fallback;
|
||||
}
|
||||
if (refresh != null) {
|
||||
params.refresh = true;
|
||||
}
|
||||
if (clip != null) {
|
||||
params.clip = true;
|
||||
}
|
||||
if (img_format != null) {
|
||||
params.img_format = img_format;
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
@@ -832,7 +857,9 @@ function info_page(rating_key, guid, history, live) {
|
||||
params.rating_key = rating_key;
|
||||
}
|
||||
|
||||
if (history) { params.source = 'history'; }
|
||||
if (history) {
|
||||
params.source = 'history';
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
@@ -840,7 +867,9 @@ function info_page(rating_key, guid, history, live) {
|
||||
function library_page(section_id) {
|
||||
var params = {};
|
||||
|
||||
if (section_id != null) { params.section_id = section_id; }
|
||||
if (section_id != null) {
|
||||
params.section_id = section_id;
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
@@ -848,8 +877,12 @@ function library_page(section_id) {
|
||||
function user_page(user_id, user) {
|
||||
var params = {};
|
||||
|
||||
if (user_id != null) { params.user_id = user_id; }
|
||||
if (user != null) { params.user = user; }
|
||||
if (user_id != null) {
|
||||
params.user_id = user_id;
|
||||
}
|
||||
if (user != null) {
|
||||
params.user = user;
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
@@ -98,20 +98,20 @@ from jellypy import common, helpers
|
||||
</p>
|
||||
</div>
|
||||
<div class="wizard-input-section">
|
||||
<label for="pms_ip_selectize">Jellyfin IP Address or Hostname</label>
|
||||
<label for="jellyfin_ip_selectize">Jellyfin IP Address or Hostname</label>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<select class="form-control pms-settings selectize-pms-ip" id="pms_ip_selectize">
|
||||
% if config['pms_identifier']:
|
||||
<option value="${config['pms_ip']}:${config['pms_port']}"
|
||||
data-identifier="${config['pms_identifier']}"
|
||||
data-ip="${config['pms_ip']}"
|
||||
data-port="${config['pms_port']}"
|
||||
data-local="${int(not int(config['pms_is_remote']))}"
|
||||
data-ssl="${config['pms_ssl']}"
|
||||
data-is_cloud="${config['pms_is_cloud']}"
|
||||
data-label="${config['pms_name'] or 'Local'}"
|
||||
selected>${config['pms_ip']}
|
||||
<select class="form-control jellyfin-settings selectize-jellyfin-ip" id="jellyfin_ip_selectize">
|
||||
% if config['jellyfin_identifier']:
|
||||
<option value="${config['jellyfin_ip']}:${config['jellyfin_port']}"
|
||||
data-identifier="${config['jellyfin_identifier']}"
|
||||
data-ip="${config['jellyfin_ip']}"
|
||||
data-port="${config['jellyfin_port']}"
|
||||
data-local="${int(not int(config['jellyfin_is_remote']))}"
|
||||
data-ssl="${config['jellyfin_ssl']}"
|
||||
data-is_cloud="${config['jellyfin_is_cloud']}"
|
||||
data-label="${config['jellyfin_name'] or 'Local'}"
|
||||
selected>${config['jellyfin_ip']}
|
||||
</option>
|
||||
% endif
|
||||
</select>
|
||||
@@ -119,36 +119,36 @@ from jellypy import common, helpers
|
||||
</div>
|
||||
</div>
|
||||
<div class="wizard-input-section">
|
||||
<label for="pms_port">Jellyfin Port</label>
|
||||
<label for="jellyfin_port">Jellyfin Port</label>
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<input type="text" class="form-control pms-settings" name="pms_port" id="pms_port"
|
||||
placeholder="8096" value="${config['pms_port']}" required>
|
||||
<input type="text" class="form-control jellyfin-settings" name="jellyfin_port" id="jellyfin_port"
|
||||
placeholder="8096" value="${config['jellyfin_port']}" required>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="pms_ssl_checkbox"
|
||||
class="checkbox-toggle pms-settings" data-id="pms_ssl" value="1"
|
||||
${helpers.checked(config['pms_ssl'])}> Use SSL
|
||||
<input type="hidden" id="pms_ssl" name="pms_ssl" value="${config['pms_ssl']}">
|
||||
<input type="checkbox" id="jellyfin_ssl_checkbox"
|
||||
class="checkbox-toggle jellyfin-settings" data-id="jellyfin_ssl" value="1"
|
||||
${helpers.checked(config['jellyfin_ssl'])}> Use SSL
|
||||
<input type="hidden" id="jellyfin_ssl" name="jellyfin_ssl" value="${config['jellyfin_ssl']}">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="pms_is_remote_checkbox"
|
||||
class="checkbox-toggle pms-settings" data-id="pms_is_remote" value="1"
|
||||
${helpers.checked(config['pms_is_remote'])}> Remote Server
|
||||
<input type="hidden" id="pms_is_remote" name="pms_is_remote"
|
||||
value="${config['pms_is_remote']}">
|
||||
<input type="checkbox" id="jellyfin_is_remote_checkbox"
|
||||
class="checkbox-toggle jellyfin-settings" data-id="jellyfin_is_remote" value="1"
|
||||
${helpers.checked(config['jellyfin_is_remote'])}> Remote Server
|
||||
<input type="hidden" id="jellyfin_is_remote" name="jellyfin_is_remote"
|
||||
value="${config['jellyfin_is_remote']}">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="pms_ip" name="pms_ip" value="${config['pms_ip']}">
|
||||
<input type="hidden" id="jellyfin_ip" name="jellyfin_ip" value="${config['jellyfin_ip']}">
|
||||
</div>
|
||||
|
||||
<div class="wizard-card" data-cardname="card4">
|
||||
@@ -162,7 +162,7 @@ from jellypy import common, helpers
|
||||
<label for="jellyfin_user">Jellyfin Username</label>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<input type="text" class="form-control pms-settings" name="jellyfin_user"
|
||||
<input type="text" class="form-control jellyfin-settings" name="jellyfin_user"
|
||||
id="jellyfin_user" value="" required>
|
||||
</div>
|
||||
</div>
|
||||
@@ -171,14 +171,14 @@ from jellypy import common, helpers
|
||||
<label for="jellyfin_password">Jellyfin Password</label>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<input type="password" class="form-control pms-settings" name="jellyfin_password"
|
||||
<input type="password" class="form-control jellyfin-settings" name="jellyfin_password"
|
||||
id="jellyfin_password" value="" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}">
|
||||
<input type="hidden" id="jellyfin_identifier" name="jellyfin_identifier" value="${config['jellyfin_identifier']}">
|
||||
<a class="btn btn-dark" id="verify-plex-server" href="#" role="button">Verify</a>
|
||||
<span style="margin-left: 10px; display: none;" id="pms-verify-status"></span>
|
||||
<span style="margin-left: 10px; display: none;" id="jellyfin-verify-status"></span>
|
||||
</div>
|
||||
|
||||
<div class="wizard-card" data-cardname="card5">
|
||||
@@ -192,7 +192,7 @@ from jellypy import common, helpers
|
||||
<label for="logging_ignore_interval">Ignore Interval</label>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<input type="text" class="form-control pms-monitoring" id="logging_ignore_interval"
|
||||
<input type="text" class="form-control jellyfin-monitoring" id="logging_ignore_interval"
|
||||
name="logging_ignore_interval" placeholder="120"
|
||||
value="${config['logging_ignore_interval']}"
|
||||
data-validate="validateIgnoreInterval" required>
|
||||
@@ -308,15 +308,15 @@ from jellypy import common, helpers
|
||||
return retValue;
|
||||
}
|
||||
|
||||
function validatePMSip(el) {
|
||||
var valid_pms_ip = el.val();
|
||||
function validatejellyfinip(el) {
|
||||
var valid_jellyfin_ip = el.val();
|
||||
var retValue = {};
|
||||
|
||||
if (valid_pms_ip === "") {
|
||||
if (valid_jellyfin_ip === "") {
|
||||
retValue.status = false;
|
||||
retValue.msg = "Please verify your server.";
|
||||
$("#pms-verify-status").html('<i class="fa fa-exclamation-circle"></i> Please verify your server.');
|
||||
$('#pms-verify-status').fadeIn('fast').delay(2000).fadeOut('fast');
|
||||
$("#jellyfin-verify-status").html('<i class="fa fa-exclamation-circle"></i> Please verify your server.');
|
||||
$('#jellyfin-verify-status').fadeIn('fast').delay(2000).fadeOut('fast');
|
||||
} else {
|
||||
retValue.status = true;
|
||||
}
|
||||
@@ -324,15 +324,15 @@ from jellypy import common, helpers
|
||||
return retValue;
|
||||
}
|
||||
|
||||
function validatePMStoken(el) {
|
||||
var valid_pms_token = el.val();
|
||||
function validatejellyfintoken(el) {
|
||||
var valid_jellyfin_token = el.val();
|
||||
var retValue = {};
|
||||
|
||||
if (valid_pms_token === "") {
|
||||
if (valid_jellyfin_token === "") {
|
||||
retValue.status = false;
|
||||
retValue.msg = "Please authenticate.";
|
||||
$("#pms-token-status").html('<i class="fa fa-exclamation-circle"></i> Please authenticate.');
|
||||
$('#pms-token-status').fadeIn('fast').delay(2000).fadeOut('fast');
|
||||
$("#jellyfin-token-status").html('<i class="fa fa-exclamation-circle"></i> Please authenticate.');
|
||||
$('#jellyfin-token-status').fadeIn('fast').delay(2000).fadeOut('fast');
|
||||
} else {
|
||||
retValue.status = true;
|
||||
}
|
||||
@@ -408,7 +408,7 @@ from jellypy import common, helpers
|
||||
}
|
||||
});
|
||||
|
||||
var $select_pms = $('#pms_ip_selectize').selectize({
|
||||
var $select_jellyfin = $('#jellyfin_ip_selectize').selectize({
|
||||
createOnBlur: true,
|
||||
openOnFocus: true,
|
||||
maxItems: 1,
|
||||
@@ -462,35 +462,35 @@ from jellypy import common, helpers
|
||||
});
|
||||
},
|
||||
onChange: function (item) {
|
||||
var pms_ip_selected = this.getItem(item)[0];
|
||||
var identifier = $(pms_ip_selected).data('identifier');
|
||||
var ip = $(pms_ip_selected).data('ip');
|
||||
var port = $(pms_ip_selected).data('port');
|
||||
var local = $(pms_ip_selected).data('local');
|
||||
var ssl = $(pms_ip_selected).data('ssl');
|
||||
var value = $(pms_ip_selected).data('value');
|
||||
var jellyfin_ip_selected = this.getItem(item)[0];
|
||||
var identifier = $(jellyfin_ip_selected).data('identifier');
|
||||
var ip = $(jellyfin_ip_selected).data('ip');
|
||||
var port = $(jellyfin_ip_selected).data('port');
|
||||
var local = $(jellyfin_ip_selected).data('local');
|
||||
var ssl = $(jellyfin_ip_selected).data('ssl');
|
||||
var value = $(jellyfin_ip_selected).data('value');
|
||||
|
||||
$("#pms_valid").val(identifier !== 'undefined' ? 'valid' : '');
|
||||
$("#pms-verify-status").html(identifier !== 'undefined' ? '<i class="fa fa-check"></i> Server found!' : '').fadeIn('fast');
|
||||
$("#jellyfin_valid").val(identifier !== 'undefined' ? 'valid' : '');
|
||||
$("#jellyfin-verify-status").html(identifier !== 'undefined' ? '<i class="fa fa-check"></i> Server found!' : '').fadeIn('fast');
|
||||
|
||||
$("#pms_identifier").val(identifier !== 'undefined' ? identifier : '');
|
||||
$('#pms_ip').val(ip !== 'undefined' ? ip : value);
|
||||
$('#pms_port').val(port !== 'undefined' ? port : 8096);
|
||||
$('#pms_is_remote_checkbox').prop('checked', (local !== 'undefined' && local === 0));
|
||||
$('#pms_is_remote').val(local !== 'undefined' && local === 0 ? 1 : 0);
|
||||
$('#pms_ssl_checkbox').prop('checked', (ssl !== 'undefined' && ssl === 1));
|
||||
$('#pms_ssl').val(ssl !== 'undefined' && ssl === 1 ? 1 : 0);
|
||||
$("#jellyfin_identifier").val(identifier !== 'undefined' ? identifier : '');
|
||||
$('#jellyfin_ip').val(ip !== 'undefined' ? ip : value);
|
||||
$('#jellyfin_port').val(port !== 'undefined' ? port : 8096);
|
||||
$('#jellyfin_is_remote_checkbox').prop('checked', (local !== 'undefined' && local === 0));
|
||||
$('#jellyfin_is_remote').val(local !== 'undefined' && local === 0 ? 1 : 0);
|
||||
$('#jellyfin_ssl_checkbox').prop('checked', (ssl !== 'undefined' && ssl === 1));
|
||||
$('#jellyfin_ssl').val(ssl !== 'undefined' && ssl === 1 ? 1 : 0);
|
||||
|
||||
|
||||
$('#pms_port').prop('readonly', false);
|
||||
$('#pms_is_remote_checkbox').prop('disabled', false);
|
||||
$('#pms_ssl_checkbox').prop('disabled', false);
|
||||
$('#jellyfin_port').prop('readonly', false);
|
||||
$('#jellyfin_is_remote_checkbox').prop('disabled', false);
|
||||
$('#jellyfin_ssl_checkbox').prop('disabled', false);
|
||||
},
|
||||
onDropdownOpen: function () {
|
||||
this.clear();
|
||||
}
|
||||
});
|
||||
var select_pms = $select_pms[0].selectize;
|
||||
var select_jellyfin = $select_jellyfin[0].selectize;
|
||||
|
||||
function getServerOptions(token) {
|
||||
/* Set token and returns server options */
|
||||
@@ -501,13 +501,13 @@ from jellypy import common, helpers
|
||||
},
|
||||
success: function (result) {
|
||||
if (result) {
|
||||
var existing_ip = $('#pms_ip').val();
|
||||
var existing_port = $('#pms_port').val();
|
||||
var existing_ip = $('#jellyfin_ip').val();
|
||||
var existing_port = $('#jellyfin_port').val();
|
||||
result.forEach(function (item) {
|
||||
if (item.ip === existing_ip && item.port === existing_port) {
|
||||
select_pms.updateOption(item.value, item);
|
||||
select_jellyfin.updateOption(item.value, item);
|
||||
} else {
|
||||
select_pms.addOption(item);
|
||||
select_jellyfin.addOption(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -515,61 +515,61 @@ from jellypy import common, helpers
|
||||
})
|
||||
}
|
||||
|
||||
var pms_verified = false;
|
||||
var jellyfin_verified = false;
|
||||
var authenticated = false;
|
||||
|
||||
$("#verify-plex-server").click(function () {
|
||||
if (!(pms_verified)) {
|
||||
var pms_ip = $("#pms_ip").val().trim();
|
||||
var pms_port = $("#pms_port").val().trim();
|
||||
var pms_identifier = $("#pms_identifier").val();
|
||||
var pms_ssl = $("#pms_ssl").val();
|
||||
var pms_is_remote = $("#pms_is_remote").val();
|
||||
if ((pms_ip !== '') || (pms_port !== '')) {
|
||||
$("#pms-verify-status").html('<i class="fa fa-refresh fa-spin"></i> Verifying server...');
|
||||
$('#pms-verify-status').fadeIn('fast');
|
||||
if (!(jellyfin_verified)) {
|
||||
var jellyfin_ip = $("#jellyfin_ip").val().trim();
|
||||
var jellyfin_port = $("#jellyfin_port").val().trim();
|
||||
var jellyfin_identifier = $("#jellyfin_identifier").val();
|
||||
var jellyfin_ssl = $("#jellyfin_ssl").val();
|
||||
var jellyfin_is_remote = $("#jellyfin_is_remote").val();
|
||||
if ((jellyfin_ip !== '') || (jellyfin_port !== '')) {
|
||||
$("#jellyfin-verify-status").html('<i class="fa fa-refresh fa-spin"></i> Verifying server...');
|
||||
$('#jellyfin-verify-status').fadeIn('fast');
|
||||
$.ajax({
|
||||
url: 'get_server_id',
|
||||
data: {
|
||||
hostname: pms_ip,
|
||||
port: pms_port,
|
||||
identifier: pms_identifier,
|
||||
ssl: pms_ssl,
|
||||
remote: pms_is_remote
|
||||
hostname: jellyfin_ip,
|
||||
port: jellyfin_port,
|
||||
identifier: jellyfin_identifier,
|
||||
ssl: jellyfin_ssl,
|
||||
remote: jellyfin_is_remote
|
||||
},
|
||||
cache: true,
|
||||
async: true,
|
||||
timeout: 5000,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
$("#pms-verify-status").html('<i class="fa fa-exclamation-circle"></i> Error verifying server: ' + textStatus);
|
||||
$('#pms-verify-status').fadeIn('fast');
|
||||
$("#jellyfin-verify-status").html('<i class="fa fa-exclamation-circle"></i> Error verifying server: ' + textStatus);
|
||||
$('#jellyfin-verify-status').fadeIn('fast');
|
||||
},
|
||||
success: function (xhr, status) {
|
||||
var result = xhr;
|
||||
var identifier = result.identifier;
|
||||
if (identifier) {
|
||||
$("#pms_identifier").val(identifier);
|
||||
$("#pms-verify-status").html('<i class="fa fa-check"></i> Server found!');
|
||||
$('#pms-verify-status').fadeIn('fast');
|
||||
pms_verified = true;
|
||||
$("#pms_valid").val("valid");
|
||||
$("#jellyfin_identifier").val(identifier);
|
||||
$("#jellyfin-verify-status").html('<i class="fa fa-check"></i> Server found!');
|
||||
$('#jellyfin-verify-status').fadeIn('fast');
|
||||
jellyfin_verified = true;
|
||||
$("#jellyfin_valid").val("valid");
|
||||
} else {
|
||||
$("#pms-verify-status").html('<i class="fa fa-exclamation-circle"></i> This is not a Plex Server!');
|
||||
$('#pms-verify-status').fadeIn('fast');
|
||||
$("#jellyfin-verify-status").html('<i class="fa fa-exclamation-circle"></i> This is not a Plex Server!');
|
||||
$('#jellyfin-verify-status').fadeIn('fast');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#pms-verify-status").html('<i class="fa fa-exclamation-circle"></i> Please enter both fields.');
|
||||
$('#pms-verify-status').fadeIn('fast');
|
||||
$("#jellyfin-verify-status").html('<i class="fa fa-exclamation-circle"></i> Please enter both fields.');
|
||||
$('#jellyfin-verify-status').fadeIn('fast');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".pms-settings").change(function () {
|
||||
pms_verified = false;
|
||||
$("#pms_valid").val("");
|
||||
$("#pms-verify-status").html("");
|
||||
$(".jellyfin-settings").change(function () {
|
||||
jellyfin_verified = false;
|
||||
$("#jellyfin_valid").val("");
|
||||
$("#jellyfin-verify-status").html("");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user