jellyfin-web/dashboard-ui/scripts/encodingsettings.js
2014-07-03 22:22:57 -04:00

80 lines
2.3 KiB
JavaScript

(function ($, document, window) {
function loadPage(page, config) {
$('#chkEnableDebugEncodingLogging', page).checked(config.EnableDebugEncodingLogging).checkboxradio('refresh');
$('.radioEncodingQuality', page).each(function() {
this.checked = config.MediaEncodingQuality == this.value;
}).checkboxradio('refresh');
$('#txtDownMixAudioBoost', page).val(config.DownMixAudioBoost);
$('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || '');
Dashboard.hideLoadingMsg();
}
$(document).on('pageinit', "#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')
});
});
}).on('pageshow', "#encodingSettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
loadPage(page, config);
});
});
window.EncodingSettingsPage = {
onSubmit: function () {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
config.EnableDebugEncodingLogging = $('#chkEnableDebugEncodingLogging', form).checked();
config.MediaEncodingQuality = $('.radioEncodingQuality:checked', form).val();
config.DownMixAudioBoost = $('#txtDownMixAudioBoost', form).val();
config.TranscodingTempPath = $('#txtTranscodingTempPath', form).val();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
};
})(jQuery, document, window);