jellyfin-web/dashboard-ui/scripts/encodingsettings.js

81 lines
2.5 KiB
JavaScript
Raw Normal View History

(function ($, document, window) {
function loadPage(page, config) {
2014-12-21 12:40:37 -07:00
$('#chkEnableDebugEncodingLogging', page).checked(config.EnableDebugLogging).checkboxradio('refresh');
$('#chkEnableThrottle', page).checked(config.EnableThrottling).checkboxradio('refresh');
2015-06-07 18:23:56 -07:00
$('.radioEncodingQuality', page).each(function () {
2014-12-26 10:45:06 -07:00
this.checked = config.EncodingQuality == this.value;
}).checkboxradio('refresh');
2015-06-07 18:23:56 -07:00
2014-04-18 10:16:25 -07:00
$('#txtDownMixAudioBoost', page).val(config.DownMixAudioBoost);
$('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || '');
2014-04-18 10:16:25 -07:00
Dashboard.hideLoadingMsg();
}
2015-06-07 18:23:56 -07:00
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("encoding").done(function (config) {
config.EnableDebugLogging = $('#chkEnableDebugEncodingLogging', form).checked();
config.EncodingQuality = $('.radioEncodingQuality:checked', form).val();
config.DownMixAudioBoost = $('#txtDownMixAudioBoost', form).val();
config.TranscodingTempPath = $('#txtTranscodingTempPath', form).val();
config.EnableThrottling = $('#chkEnableThrottle', form).checked();
ApiClient.updateNamedConfiguration("encoding", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
$(document).on('pageinitdepends', "#encodingSettingsPage", function () {
var page = this;
$('#btnSelectTranscodingTempPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtTranscodingTempPath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectTranscodingPath'),
instruction: Globalize.translate('HeaderSelectTranscodingPathHelp')
});
});
2015-06-07 18:23:56 -07:00
$('.encodingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#encodingSettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
2014-12-21 12:40:37 -07:00
ApiClient.getNamedConfiguration("encoding").done(function (config) {
loadPage(page, config);
});
});
})(jQuery, document, window);