Refactor of plugin structure to make more sense compared to the default template
This commit is contained in:
40
Jellyfin.Plugin.MediaCleaner/Pages/configuration.js
Normal file
40
Jellyfin.Plugin.MediaCleaner/Pages/configuration.js
Normal file
@@ -0,0 +1,40 @@
|
||||
var MediaCleanerConfig = {
|
||||
pluginUniqueId: 'fef007a8-3e8f-4aa8-a22e-486a387f4192'
|
||||
};
|
||||
|
||||
document.querySelector('#MediaCleanerConfigPage')
|
||||
.addEventListener('pageshow', function() {
|
||||
Dashboard.showLoadingMsg();
|
||||
ApiClient.getPluginConfiguration(MediaCleanerConfig.pluginUniqueId).then(function (config) {
|
||||
document.querySelector('#RadarrHTTPAddress').value = config.RadarrHTTPAddress;
|
||||
document.querySelector('#RadarrPort').value = config.RadarrPort;
|
||||
document.querySelector('#RadarrAPIKey').value = config.RadarrAPIKey;
|
||||
document.querySelector('#SonarrHTTPAddress').value = config.SonarrHTTPAddress;
|
||||
document.querySelector('#SonarrPort').value = config.SonarrPort;
|
||||
document.querySelector('#SonarrAPIKey').value = config.SonarrAPIKey;
|
||||
document.querySelector('#StaleMediaCutoff').value = config.StaleMediaCutoff;
|
||||
document.querySelector('#DebugMode').checked = config.DebugMode;
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector('#MediaCleanerConfigForm')
|
||||
.addEventListener('submit', function(e) {
|
||||
Dashboard.showLoadingMsg();
|
||||
ApiClient.getPluginConfiguration(MediaCleanerConfig.pluginUniqueId).then(function (config) {
|
||||
config.RadarrHTTPAddress = document.querySelector('#RadarrHTTPAddress').value;
|
||||
config.RadarrPort = document.querySelector('#RadarrPort').value;
|
||||
config.RadarrAPIKey = document.querySelector('#RadarrAPIKey').value;
|
||||
config.SonarrHTTPAddress = document.querySelector('#SonarrHTTPAddress').value;
|
||||
config.SonarrPort = document.querySelector('#SonarrPort').value;
|
||||
config.SonarrAPIKey = document.querySelector('#SonarrAPIKey').value;
|
||||
config.StaleMediaCutoff = document.querySelector('#StaleMediaCutoff').value;
|
||||
config.DebugMode = document.querySelector('#DebugMode').checked;
|
||||
ApiClient.updatePluginConfiguration(MediaCleanerConfig.pluginUniqueId, config).then(function (result) {
|
||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||
});
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
Reference in New Issue
Block a user