remove fanart settings from frontend and move to plugin

This commit is contained in:
dkanada 2019-05-31 00:09:24 -07:00
parent 30ffa4b13e
commit 2d68b13ef5

View File

@ -3,29 +3,12 @@ define(["jQuery", "loading", "libraryMenu", "fnchecked", "emby-checkbox", "emby-
function loadPage(page, config) { function loadPage(page, config) {
$("#chkSaveMetadataHidden", page).checked(config.SaveMetadataHidden); $("#chkSaveMetadataHidden", page).checked(config.SaveMetadataHidden);
loading.hide();
} }
function loadMetadataConfig(page, config) { function loadMetadataConfig(page, config) {
$("#selectDateAdded", page).val(config.UseFileCreationTimeForDateAdded ? "1" : "0"); $("#selectDateAdded", page).val(config.UseFileCreationTimeForDateAdded ? "1" : "0");
} }
function loadFanartConfig(page, config) {
$("#txtFanartApiKey", page).val(config.UserApiKey || "");
}
function saveFanart(form) {
ApiClient.getNamedConfiguration("fanart").then(function(config) {
config.UserApiKey = $("#txtFanartApiKey", form).val(), ApiClient.updateNamedConfiguration("fanart", config);
});
}
function saveMetadata(form) {
ApiClient.getNamedConfiguration("metadata").then(function(config) {
config.UseFileCreationTimeForDateAdded = "1" === $("#selectDateAdded", form).val(), ApiClient.updateNamedConfiguration("metadata", config);
})
}
function alertText(options) { function alertText(options) {
require(["alert"], function(alert) { require(["alert"], function(alert) {
alert(options); alert(options);
@ -37,11 +20,13 @@ define(["jQuery", "loading", "libraryMenu", "fnchecked", "emby-checkbox", "emby-
var form = this; var form = this;
ApiClient.getServerConfiguration().then(function(config) { ApiClient.getServerConfiguration().then(function(config) {
config.SaveMetadataHidden = $("#chkSaveMetadataHidden", form).checked(); config.SaveMetadataHidden = $("#chkSaveMetadataHidden", form).checked();
config.FanartApiKey = $("#txtFanartApiKey", form).val();
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult); ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
}); });
saveMetadata(form); ApiClient.getNamedConfiguration("metadata").then(function(config) {
saveFanart(form); config.UseFileCreationTimeForDateAdded = "1" === $("#selectDateAdded", form).val();
ApiClient.updateNamedConfiguration("metadata", config);
});
loading.hide();
return false; return false;
} }
@ -76,9 +61,6 @@ define(["jQuery", "loading", "libraryMenu", "fnchecked", "emby-checkbox", "emby-
ApiClient.getNamedConfiguration("metadata").then(function(metadata) { ApiClient.getNamedConfiguration("metadata").then(function(metadata) {
loadMetadataConfig(page, metadata) loadMetadataConfig(page, metadata)
}); });
ApiClient.getNamedConfiguration("fanart").then(function(metadata) {
loadFanartConfig(page, metadata)
});
ApiClient.getSystemInfo().then(function(info) { ApiClient.getSystemInfo().then(function(info) {
if ("Windows" === info.OperatingSystem) { if ("Windows" === info.OperatingSystem) {
page.querySelector(".fldSaveMetadataHidden").classList.remove("hide"); page.querySelector(".fldSaveMetadataHidden").classList.remove("hide");
@ -86,6 +68,7 @@ define(["jQuery", "loading", "libraryMenu", "fnchecked", "emby-checkbox", "emby-
page.querySelector(".fldSaveMetadataHidden").classList.add("hide"); page.querySelector(".fldSaveMetadataHidden").classList.add("hide");
} }
}); });
loading.hide();
}); });
} }
}); });