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

82 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');
$('.radioEncodingQuality', page).each(function() {
2014-12-26 10:45:06 -07:00
this.checked = config.EncodingQuality == this.value;
}).checkboxradio('refresh');
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();
}
$(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;
2014-12-21 12:40:37 -07:00
ApiClient.getNamedConfiguration("encoding").done(function (config) {
loadPage(page, config);
});
});
window.EncodingSettingsPage = {
onSubmit: function () {
Dashboard.showLoadingMsg();
var form = this;
2014-12-21 12:40:37 -07:00
ApiClient.getNamedConfiguration("encoding").done(function (config) {
2014-12-21 12:40:37 -07:00
config.EnableDebugLogging = $('#chkEnableDebugEncodingLogging', form).checked();
2014-12-26 10:45:06 -07:00
config.EncodingQuality = $('.radioEncodingQuality:checked', form).val();
2014-04-18 10:16:25 -07:00
config.DownMixAudioBoost = $('#txtDownMixAudioBoost', form).val();
config.TranscodingTempPath = $('#txtTranscodingTempPath', form).val();
config.EnableThrottling = $('#chkEnableThrottle', form).checked();
2014-12-21 12:40:37 -07:00
ApiClient.updateNamedConfiguration("encoding", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
};
})(jQuery, document, window);