Files
nfoguard/NFOGuard.Emby.Plugin/Configuration/configPage.html
T
2025-09-12 09:04:23 -04:00

91 lines
3.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>NFOGuard Settings</title>
</head>
<body data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox">
<div data-role="content">
<div class="content-primary">
<form id="nfoguardConfigForm">
<h1>NFOGuard Settings</h1>
<p>Configure how NFOGuard synchronizes TV episode dates in Emby.</p>
<div class="inputContainer">
<label class="checkboxContainer">
<input type="checkbox" is="emby-checkbox" id="chkEnableRealTimeSync" />
<span>Enable Real-time Sync</span>
</label>
<div class="fieldDescription">Automatically sync PremiereDate to DateCreated when episodes are added or updated</div>
</div>
<div class="inputContainer">
<label class="checkboxContainer">
<input type="checkbox" is="emby-checkbox" id="chkEnableScheduledTask" />
<span>Enable Scheduled Task</span>
</label>
<div class="fieldDescription">Run NFOGuard as a scheduled task to process existing episodes</div>
</div>
<div class="inputContainer">
<label class="checkboxContainer">
<input type="checkbox" is="emby-checkbox" id="chkLogVerbose" />
<span>Verbose Logging</span>
</label>
<div class="fieldDescription">Enable detailed logging for troubleshooting</div>
</div>
<br/>
<div>
<button is="emby-button" type="submit" class="raised button-submit block">
Save
</button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
(function () {
var pluginId = "B8A7F9E2-1234-4567-8901-2B3C4D5E6F7A";
function loadPage() {
ApiClient.getPluginConfiguration(pluginId).then(function (config) {
document.getElementById('chkEnableRealTimeSync').checked = config.EnableRealTimeSync !== false;
document.getElementById('chkEnableScheduledTask').checked = config.EnableScheduledTask === true;
document.getElementById('chkLogVerbose').checked = config.LogVerbose === true;
}).catch(function(err) {
console.error('Error loading NFOGuard config:', err);
});
}
function saveConfig() {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(pluginId).then(function (config) {
config.EnableRealTimeSync = document.getElementById('chkEnableRealTimeSync').checked;
config.EnableScheduledTask = document.getElementById('chkEnableScheduledTask').checked;
config.LogVerbose = document.getElementById('chkLogVerbose').checked;
return ApiClient.updatePluginConfiguration(pluginId, config);
}).then(function () {
Dashboard.hideLoadingMsg();
Dashboard.alert('Settings saved successfully.');
}).catch(function (err) {
Dashboard.hideLoadingMsg();
Dashboard.alert('Error saving settings: ' + (err.message || err));
console.error('Save error:', err);
});
}
document.getElementById('nfoguardConfigForm').addEventListener('submit', function (e) {
e.preventDefault();
saveConfig();
return false;
});
// Load settings when page loads
loadPage();
})();
</script>
</body>
</html>