2014-01-07 13:39:35 -05:00
|
|
|
|
(function ($, document, window) {
|
|
|
|
|
|
|
|
|
|
function loadPage(page, config) {
|
|
|
|
|
|
2014-12-21 14:40:37 -05:00
|
|
|
|
$('#chkEnableDebugEncodingLogging', page).checked(config.EnableDebugLogging).checkboxradio('refresh');
|
2015-03-30 12:16:34 -04:00
|
|
|
|
$('#chkEnableThrottle', page).checked(config.EnableThrottling).checkboxradio('refresh');
|
|
|
|
|
|
2015-06-07 21:23:56 -04:00
|
|
|
|
$('.radioEncodingQuality', page).each(function () {
|
2014-01-07 13:39:35 -05:00
|
|
|
|
|
2014-12-26 12:45:06 -05:00
|
|
|
|
this.checked = config.EncodingQuality == this.value;
|
2014-01-07 13:39:35 -05:00
|
|
|
|
|
|
|
|
|
}).checkboxradio('refresh');
|
2015-06-07 21:23:56 -04:00
|
|
|
|
|
2015-09-17 23:08:45 -04:00
|
|
|
|
$('#selectVideoDecoder', page).val(config.HardwareVideoDecoder);
|
2015-09-03 13:01:51 -04:00
|
|
|
|
$('#selectThreadCount', page).val(config.EncodingThreadCount);
|
2014-04-18 13:16:25 -04:00
|
|
|
|
$('#txtDownMixAudioBoost', page).val(config.DownMixAudioBoost);
|
2014-07-03 22:22:57 -04:00
|
|
|
|
$('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || '');
|
2014-04-18 13:16:25 -04:00
|
|
|
|
|
2014-01-07 13:39:35 -05:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-07 21:23:56 -04: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();
|
2015-07-30 21:52:11 -04:00
|
|
|
|
config.EncodingThreadCount = $('#selectThreadCount', form).val();
|
2015-09-17 23:08:45 -04:00
|
|
|
|
config.HardwareVideoDecoder = $('#selectVideoDecoder', form).val();
|
2015-06-07 21:23:56 -04:00
|
|
|
|
|
|
|
|
|
ApiClient.updateNamedConfiguration("encoding", config).done(Dashboard.processServerConfigurationUpdateResult);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 10:01:59 -04:00
|
|
|
|
$(document).on('pageinit', "#encodingSettingsPage", function () {
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('#btnSelectTranscodingTempPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
var picker = new directoryBrowser();
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
picker.show({
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
callback: function (path) {
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtTranscodingTempPath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
|
|
|
|
},
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
header: Globalize.translate('HeaderSelectTranscodingPath'),
|
|
|
|
|
|
|
|
|
|
instruction: Globalize.translate('HeaderSelectTranscodingPathHelp')
|
|
|
|
|
});
|
2014-07-03 22:22:57 -04:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2015-06-07 21:23:56 -04:00
|
|
|
|
$('.encodingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
|
|
|
|
|
|
|
|
|
|
2015-09-24 13:08:10 -04:00
|
|
|
|
}).on('pageshow', "#encodingSettingsPage", function () {
|
2014-01-07 13:39:35 -05:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2014-12-21 14:40:37 -05:00
|
|
|
|
ApiClient.getNamedConfiguration("encoding").done(function (config) {
|
2014-01-07 13:39:35 -05:00
|
|
|
|
|
|
|
|
|
loadPage(page, config);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, document, window);
|