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

74 lines
2.0 KiB
JavaScript
Raw Normal View History

2013-09-05 10:05:39 -07:00
(function ($, document) {
function save(page) {
Dashboard.showLoadingMsg();
ApiClient.getScheduledTasks().done(function (tasks) {
var chapterTask = tasks.filter(function (t) {
return t.Name.toLowerCase() == 'chapter image extraction';
})[0];
if (!chapterTask) {
throw new Error('Cannot find chapter scheduled task');
}
// First update the chapters scheduled task
var triggers = $('#chkChapters', page).checked() ? [{
"Type": "DailyTrigger",
"TimeOfDayTicks": 144000000000
}] : [];
ApiClient.updateScheduledTaskTriggers(chapterTask.Id, triggers).done(function () {
// After saving chapter task, now save server config
ApiClient.getServerConfiguration().done(function (config) {
config.SaveLocalMeta = $('#chkSaveLocalMetadata', page).checked();
config.EnableVideoImageExtraction = $('#chkVIdeoImages', page).checked();
config.ImageSavingConvention = $('#selectImageSavingConvention', page).val();
2013-09-05 10:05:39 -07:00
ApiClient.updateServerConfiguration(config).done(function (result) {
2013-09-05 10:05:39 -07:00
Dashboard.processServerConfigurationUpdateResult(result);
navigateToNextPage();
2013-09-05 10:05:39 -07:00
});
});
});
});
}
function navigateToNextPage() {
ApiClient.getSystemInfo().done(function (systemInfo) {
var os = systemInfo.OperatingSystem.toLowerCase();
if (os.indexOf('windows') != -1) {
Dashboard.navigate('wizardservice.html');
} else {
Dashboard.navigate('wizardfinish.html');
}
});
}
2013-09-05 10:05:39 -07:00
$(document).on('pageinit', "#wizardSettingsPage", function () {
var page = this;
$('#btnNextPage', page).on('click', function () {
save(page);
});
});
})(jQuery, document, window);