mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update path configs
This commit is contained in:
parent
e8b542348f
commit
b1a7dbd507
4 changed files with 62 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
|||
define(['jQuery'], function ($) {
|
||||
|
||||
function loadPage(page, config) {
|
||||
function loadPage(page, config, systemInfo) {
|
||||
|
||||
page.querySelector('#chkEnableThrottle').checked = config.EnableThrottling;
|
||||
|
||||
|
@ -10,6 +10,11 @@
|
|||
page.querySelector('.txtEncoderPath').value = config.EncoderAppPath || '';
|
||||
$('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || '');
|
||||
|
||||
var selectEncoderPath = page.querySelector('#selectEncoderPath');
|
||||
|
||||
selectEncoderPath.value = systemInfo.EncoderLocationType;
|
||||
onSelectEncoderPathChange.call(selectEncoderPath);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
|
@ -27,6 +32,25 @@
|
|||
});
|
||||
}
|
||||
|
||||
function updateEncoder(form) {
|
||||
|
||||
return ApiClient.getSystemInfo().then(function(systemInfo) {
|
||||
|
||||
if (systemInfo.EncoderLocationType == "External") {
|
||||
return;
|
||||
}
|
||||
|
||||
return ApiClient.ajax({
|
||||
url: ApiClient.getUrl('System/MediaEncoder/Path'),
|
||||
type: 'POST',
|
||||
data: {
|
||||
Path: form.querySelector('.txtEncoderPath').value,
|
||||
PathType: form.querySelector('#selectEncoderPath').value
|
||||
}
|
||||
}).then(Dashboard.processServerConfigurationUpdateResult, onSaveEncodingPathFailure);
|
||||
});
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
|
||||
var form = this;
|
||||
|
@ -45,14 +69,7 @@
|
|||
|
||||
ApiClient.updateNamedConfiguration("encoding", config).then(function () {
|
||||
|
||||
ApiClient.ajax({
|
||||
url: ApiClient.getUrl('System/MediaEncoder/Path'),
|
||||
type: 'POST',
|
||||
data: {
|
||||
Path: form.querySelector('.txtEncoderPath').value
|
||||
}
|
||||
}).then(Dashboard.processServerConfigurationUpdateResult, onSaveEncodingPathFailure);
|
||||
|
||||
updateEncoder(form);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -95,6 +112,17 @@
|
|||
}];
|
||||
}
|
||||
|
||||
function onSelectEncoderPathChange(e) {
|
||||
|
||||
var page = $(this).parents('.page')[0];
|
||||
|
||||
if (this.value == 'Custom') {
|
||||
page.querySelector('.fldEncoderPath').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.fldEncoderPath').classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#encodingSettingsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
@ -144,6 +172,7 @@
|
|||
|
||||
$('.encodingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
page.querySelector('#selectEncoderPath').addEventListener('change', onSelectEncoderPathChange);
|
||||
|
||||
}).on('pageshow', "#encodingSettingsPage", function () {
|
||||
|
||||
|
@ -154,17 +183,17 @@
|
|||
|
||||
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
|
||||
if (systemInfo.EncoderLocationType == "External") {
|
||||
page.querySelector('.fldSelectEncoderPathType').classList.add('hide');
|
||||
} else {
|
||||
page.querySelector('.fldSelectEncoderPathType').classList.remove('hide');
|
||||
}
|
||||
loadPage(page, config, systemInfo);
|
||||
});
|
||||
});
|
||||
|
||||
ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
|
||||
if (systemInfo.HasExternalEncoder) {
|
||||
page.querySelector('.fldEncoderPath').classList.add('hide');
|
||||
} else {
|
||||
page.querySelector('.fldEncoderPath').classList.remove('hide');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue