2014-01-07 11:39:35 -07:00
|
|
|
|
(function ($, document, window) {
|
|
|
|
|
|
|
|
|
|
function loadPage(page, config) {
|
|
|
|
|
|
2016-02-08 19:15:26 -07:00
|
|
|
|
page.querySelector('#chkEnableThrottle').checked = config.EnableThrottling;
|
2015-03-30 09:16:34 -07:00
|
|
|
|
|
2015-06-07 18:23:56 -07:00
|
|
|
|
$('.radioEncodingQuality', page).each(function () {
|
2014-01-07 11:39:35 -07:00
|
|
|
|
|
2014-12-26 10:45:06 -07:00
|
|
|
|
this.checked = config.EncodingQuality == this.value;
|
2014-01-07 11:39:35 -07:00
|
|
|
|
|
|
|
|
|
}).checkboxradio('refresh');
|
2015-06-07 18:23:56 -07:00
|
|
|
|
|
2015-11-26 21:33:20 -07:00
|
|
|
|
$('#selectVideoDecoder', page).val(config.HardwareAccelerationType);
|
2015-09-03 10:01:51 -07:00
|
|
|
|
$('#selectThreadCount', page).val(config.EncodingThreadCount);
|
2014-04-18 10:16:25 -07:00
|
|
|
|
$('#txtDownMixAudioBoost', page).val(config.DownMixAudioBoost);
|
2014-07-03 19:22:57 -07:00
|
|
|
|
$('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || '');
|
2014-04-18 10:16:25 -07:00
|
|
|
|
|
2014-01-07 11:39:35 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-07 18:23:56 -07:00
|
|
|
|
function onSubmit() {
|
|
|
|
|
|
|
|
|
|
var form = this;
|
|
|
|
|
|
2016-02-04 21:56:07 -07:00
|
|
|
|
var onDecoderConfirmed = function() {
|
|
|
|
|
Dashboard.showLoadingMsg();
|
2015-06-07 18:23:56 -07:00
|
|
|
|
|
2016-02-04 21:56:07 -07:00
|
|
|
|
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
|
|
|
|
|
|
|
|
|
config.EncodingQuality = $('.radioEncodingQuality:checked', form).val();
|
|
|
|
|
config.DownMixAudioBoost = $('#txtDownMixAudioBoost', form).val();
|
|
|
|
|
config.TranscodingTempPath = $('#txtTranscodingTempPath', form).val();
|
|
|
|
|
config.EncodingThreadCount = $('#selectThreadCount', form).val();
|
|
|
|
|
config.HardwareAccelerationType = $('#selectVideoDecoder', form).val();
|
|
|
|
|
|
2016-02-08 19:15:26 -07:00
|
|
|
|
config.EnableThrottling = form.querySelector('#chkEnableThrottle').checked;
|
|
|
|
|
|
2016-02-04 21:56:07 -07:00
|
|
|
|
ApiClient.updateNamedConfiguration("encoding", config).then(Dashboard.processServerConfigurationUpdateResult);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if ($('#selectVideoDecoder', form).val()) {
|
|
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
callback: onDecoderConfirmed,
|
|
|
|
|
title: Globalize.translate('TitleHardwareAcceleration'),
|
|
|
|
|
message: Globalize.translate('HardwareAccelerationWarning')
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
onDecoderConfirmed();
|
|
|
|
|
}
|
2015-06-07 18:23:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
$(document).on('pageinit', "#encodingSettingsPage", function () {
|
2014-07-03 19:22:57 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('#btnSelectTranscodingTempPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
2014-07-03 19:22:57 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
var picker = new directoryBrowser();
|
2014-07-03 19:22:57 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
picker.show({
|
2014-07-03 19:22:57 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
callback: function (path) {
|
2014-07-03 19:22:57 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtTranscodingTempPath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
|
|
|
|
},
|
2014-07-03 19:22:57 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
header: Globalize.translate('HeaderSelectTranscodingPath'),
|
|
|
|
|
|
|
|
|
|
instruction: Globalize.translate('HeaderSelectTranscodingPathHelp')
|
|
|
|
|
});
|
2014-07-03 19:22:57 -07:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2015-06-07 18:23:56 -07:00
|
|
|
|
$('.encodingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
|
|
|
|
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
}).on('pageshow', "#encodingSettingsPage", function () {
|
2014-01-07 11:39:35 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
2014-01-07 11:39:35 -07:00
|
|
|
|
|
|
|
|
|
loadPage(page, config);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, document, window);
|