diff --git a/dashboard-ui/scripts/dlnaserversettings.js b/dashboard-ui/scripts/dlnaserversettings.js index 383258c994..35ba4e9477 100644 --- a/dashboard-ui/scripts/dlnaserversettings.js +++ b/dashboard-ui/scripts/dlnaserversettings.js @@ -2,15 +2,15 @@ function loadPage(page, config, users) { - $('#chkEnableServer', page).checked(config.DlnaOptions.EnableServer).checkboxradio("refresh"); - $('#chkBlastAliveMessages', page).checked(config.DlnaOptions.BlastAliveMessages).checkboxradio("refresh"); - $('#txtBlastInterval', page).val(config.DlnaOptions.BlastAliveMessageIntervalSeconds); + $('#chkEnableServer', page).checked(config.EnableServer).checkboxradio("refresh"); + $('#chkBlastAliveMessages', page).checked(config.BlastAliveMessages).checkboxradio("refresh"); + $('#txtBlastInterval', page).val(config.BlastAliveMessageIntervalSeconds); var usersHtml = users.map(function (u) { return ''; }).join(''); - $('#selectUser', page).html(usersHtml).val(config.DlnaOptions.DefaultUserId || '').selectmenu("refresh"); + $('#selectUser', page).html(usersHtml).val(config.DefaultUserId || '').selectmenu("refresh"); Dashboard.hideLoadingMsg(); } @@ -21,7 +21,7 @@ var page = this; - var promise1 = ApiClient.getServerConfiguration(); + var promise1 = ApiClient.getNamedConfiguration("dlna"); var promise2 = ApiClient.getUsers(); $.when(promise1, promise2).done(function (response1, response2) { @@ -38,14 +38,14 @@ var form = this; - ApiClient.getServerConfiguration().done(function (config) { + ApiClient.getNamedConfiguration("dlna").done(function (config) { - config.DlnaOptions.EnableServer = $('#chkEnableServer', form).checked(); - config.DlnaOptions.BlastAliveMessages = $('#chkBlastAliveMessages', form).checked(); - config.DlnaOptions.BlastAliveMessageIntervalSeconds = $('#txtBlastInterval', form).val(); - config.DlnaOptions.DefaultUserId = $('#selectUser', form).val(); + config.EnableServer = $('#chkEnableServer', form).checked(); + config.BlastAliveMessages = $('#chkBlastAliveMessages', form).checked(); + config.BlastAliveMessageIntervalSeconds = $('#txtBlastInterval', form).val(); + config.DefaultUserId = $('#selectUser', form).val(); - ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult); + ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult); }); // Disable default form submission diff --git a/dashboard-ui/scripts/dlnasettings.js b/dashboard-ui/scripts/dlnasettings.js index d087ca38be..e32e771575 100644 --- a/dashboard-ui/scripts/dlnasettings.js +++ b/dashboard-ui/scripts/dlnasettings.js @@ -2,9 +2,9 @@ function loadPage(page, config) { - $('#chkEnablePlayTo', page).checked(config.DlnaOptions.EnablePlayTo).checkboxradio("refresh"); - $('#chkEnableDlnaDebugLogging', page).checked(config.DlnaOptions.EnableDebugLogging).checkboxradio("refresh"); - $('#txtClientDiscoveryInterval', page).val(config.DlnaOptions.ClientDiscoveryIntervalSeconds); + $('#chkEnablePlayTo', page).checked(config.EnablePlayTo).checkboxradio("refresh"); + $('#chkEnableDlnaDebugLogging', page).checked(config.EnableDebugLogging).checkboxradio("refresh"); + $('#txtClientDiscoveryInterval', page).val(config.ClientDiscoveryIntervalSeconds); Dashboard.hideLoadingMsg(); } @@ -15,7 +15,7 @@ var page = this; - ApiClient.getServerConfiguration().done(function (config) { + ApiClient.getNamedConfiguration("dlna").done(function (config) { loadPage(page, config); @@ -29,13 +29,13 @@ var form = this; - ApiClient.getServerConfiguration().done(function (config) { + ApiClient.getNamedConfiguration("dlna").done(function (config) { - config.DlnaOptions.EnablePlayTo = $('#chkEnablePlayTo', form).checked(); - config.DlnaOptions.EnableDebugLogging = $('#chkEnableDlnaDebugLogging', form).checked(); - config.DlnaOptions.ClientDiscoveryIntervalSeconds = $('#txtClientDiscoveryInterval', form).val(); + config.EnablePlayTo = $('#chkEnablePlayTo', form).checked(); + config.EnableDebugLogging = $('#chkEnableDlnaDebugLogging', form).checked(); + config.ClientDiscoveryIntervalSeconds = $('#txtClientDiscoveryInterval', form).val(); - ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult); + ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult); }); // Disable default form submission diff --git a/dashboard-ui/scripts/metadatachapters.js b/dashboard-ui/scripts/metadatachapters.js index 63bb5be1ac..edb611fb5e 100644 --- a/dashboard-ui/scripts/metadatachapters.js +++ b/dashboard-ui/scripts/metadatachapters.js @@ -10,12 +10,12 @@ $('.chapterDownloadSettings', page).hide(); } - $('#chkChaptersMovies', page).checked(config.ChapterOptions.EnableMovieChapterImageExtraction).checkboxradio("refresh"); - $('#chkChaptersEpisodes', page).checked(config.ChapterOptions.EnableEpisodeChapterImageExtraction).checkboxradio("refresh"); - $('#chkChaptersOtherVideos', page).checked(config.ChapterOptions.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh"); + $('#chkChaptersMovies', page).checked(config.EnableMovieChapterImageExtraction).checkboxradio("refresh"); + $('#chkChaptersEpisodes', page).checked(config.EnableEpisodeChapterImageExtraction).checkboxradio("refresh"); + $('#chkChaptersOtherVideos', page).checked(config.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh"); - $('#chkDownloadChapterMovies', page).checked(config.ChapterOptions.DownloadMovieChapters).checkboxradio("refresh"); - $('#chkDownloadChapterEpisodes', page).checked(config.ChapterOptions.DownloadEpisodeChapters).checkboxradio("refresh"); + $('#chkDownloadChapterMovies', page).checked(config.DownloadMovieChapters).checkboxradio("refresh"); + $('#chkDownloadChapterEpisodes', page).checked(config.DownloadEpisodeChapters).checkboxradio("refresh"); renderChapterFetchers(page, config, providers); @@ -46,7 +46,7 @@ id = 'chkChapterFetcher' + i; - var isChecked = config.ChapterOptions.DisabledFetchers.indexOf(plugin.Name) == -1 ? ' checked="checked"' : ''; + var isChecked = config.DisabledFetchers.indexOf(plugin.Name) == -1 ? ' checked="checked"' : ''; html += ''; html += ''; @@ -116,7 +116,7 @@ var page = this; - var promise1 = ApiClient.getServerConfiguration(); + var promise1 = ApiClient.getNamedConfiguration("chapters"); var promise2 = $.getJSON(ApiClient.getUrl("Providers/Chapters")); $.when(promise1, promise2).done(function (response1, response2) { @@ -134,28 +134,28 @@ var form = this; - ApiClient.getServerConfiguration().done(function (config) { + ApiClient.getNamedConfiguration("chapters").done(function (config) { - config.ChapterOptions.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked(); - config.ChapterOptions.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked(); - config.ChapterOptions.EnableOtherVideoChapterImageExtraction = $('#chkChaptersOtherVideos', form).checked(); + config.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked(); + config.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked(); + config.EnableOtherVideoChapterImageExtraction = $('#chkChaptersOtherVideos', form).checked(); - config.ChapterOptions.DownloadMovieChapters = $('#chkDownloadChapterMovies', form).checked(); - config.ChapterOptions.DownloadEpisodeChapters = $('#chkDownloadChapterEpisodes', form).checked(); + config.DownloadMovieChapters = $('#chkDownloadChapterMovies', form).checked(); + config.DownloadEpisodeChapters = $('#chkDownloadChapterEpisodes', form).checked(); - config.ChapterOptions.DisabledFetchers = $('.chkChapterFetcher:not(:checked)', form).get().map(function (c) { + config.DisabledFetchers = $('.chkChapterFetcher:not(:checked)', form).get().map(function (c) { return c.getAttribute('data-pluginname'); }); - config.ChapterOptions.FetcherOrder = $('.chkChapterFetcher', form).get().map(function (c) { + config.FetcherOrder = $('.chkChapterFetcher', form).get().map(function (c) { return c.getAttribute('data-pluginname'); }); - ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult); + ApiClient.updateNamedConfiguration("chapters", config).done(Dashboard.processServerConfigurationUpdateResult); }); // Disable default form submission diff --git a/dashboard-ui/scripts/wizardimagesettings.js b/dashboard-ui/scripts/wizardimagesettings.js index 11bd835ee9..e057e79879 100644 --- a/dashboard-ui/scripts/wizardimagesettings.js +++ b/dashboard-ui/scripts/wizardimagesettings.js @@ -14,14 +14,20 @@ // After saving chapter task, now save server config ApiClient.getServerConfiguration().done(function (config) { - config.ChapterOptions.EnableMovieChapterImageExtraction = $('#chkMovies', page).checked(); - config.EnableUPnP = $('#chkEnableUpnp', page).checked(); ApiClient.updateServerConfiguration(config).done(function (result) { - navigateToNextPage(); + ApiClient.getNamedConfiguration("chapters").done(function (chapterConfig) { + chapterConfig.EnableMovieChapterImageExtraction = $('#chkMovies', page).checked(); + + ApiClient.updateNamedConfiguration("chapters", chapterConfig).done(function () { + + navigateToNextPage(); + + }); + }); }); }); }); diff --git a/dashboard-ui/thirdparty/mediabrowser.apiclient.js b/dashboard-ui/thirdparty/mediabrowser.apiclient.js index 2b8970cc1e..9eccf789de 100644 --- a/dashboard-ui/thirdparty/mediabrowser.apiclient.js +++ b/dashboard-ui/thirdparty/mediabrowser.apiclient.js @@ -1310,6 +1310,17 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi dataType: "json" }); }; + + self.getNamedConfiguration = function (name) { + + var url = self.getUrl("System/Configuration/" + name); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; /** * Gets the server's scheduled tasks @@ -2393,6 +2404,22 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi }); }; + self.updateNamedConfiguration = function (name, configuration) { + + if (!configuration) { + throw new Error("null configuration"); + } + + var url = self.getUrl("System/Configuration/" + name); + + return self.ajax({ + type: "POST", + url: url, + data: JSON.stringify(configuration), + contentType: "application/json" + }); + }; + self.updateItem = function (item) { if (!item) {