1
0
Fork 0
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:
Luke Pulverenti 2016-06-29 01:49:31 -04:00
parent e8b542348f
commit b1a7dbd507
4 changed files with 62 additions and 22 deletions

View file

@ -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');
}
});
});
});

View file

@ -16,10 +16,10 @@
view.querySelector('.suggestedLocation').innerHTML = Globalize.translate('FFmpegSuggestedDownload', '<a target="_blank" href="https://ffmpeg.zeranoe.com/builds">https://ffmpeg.zeranoe.com</a>');
if (systemInfo.SystemArchitecture == 'X86') {
instructions = 'Download 32-Bit Static';
instructions = 'Download FFmpeg 32-Bit Static';
}
else if (systemInfo.SystemArchitecture == 'X64') {
instructions = 'Download 64-Bit Static';
instructions = 'Download FFmpeg 64-Bit Static';
}
view.querySelector('.downloadInstructions').innerHTML = instructions;
@ -90,7 +90,8 @@
url: ApiClient.getUrl('System/MediaEncoder/Path'),
type: 'POST',
data: {
Path: form.querySelector('.txtEncoderPath').value
Path: form.querySelector('.txtEncoderPath').value,
PathType: 'Custom'
}
}).then(goNext, onSaveEncodingPathFailure);