Added configuration page

This commit is contained in:
2025-11-23 16:06:58 -07:00
parent 0bace555ab
commit 7f03a47923
4 changed files with 48 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>0.0.0.0</Version>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<FileVersion>0.0.0.0</FileVersion>
<Version>10.12.0.0</Version>
<AssemblyVersion>10.12.0.0</AssemblyVersion>
<FileVersion>0.0.0.1</FileVersion>
</PropertyGroup>
</Project>

View File

@@ -13,4 +13,19 @@ public class PluginConfiguration : BasePluginConfiguration
public PluginConfiguration()
{
}
/// <summary>
/// Gets or sets the api for your Radarr instance.
/// </summary>
public string RadarrAPIKey { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the api for your Sonarr instance.
/// </summary>
public string SonarrAPIKey { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the cut off days before deleting unwatched files.
/// </summary>
public int DaysUnwatched { get; set; } = 90;
}

View File

@@ -2,13 +2,28 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Template</title>
<title>Media Cleaner</title>
</head>
<body>
<div id="TemplateConfigPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox">
<div id="MediaCleanerConfigPage" 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="TemplateConfigForm">
<form id="MediaCleanerConfigForm">
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="RadarrAPIKey">Radarr API Key</label>
<input id="RadarrAPIKey" name="RadarrAPIKey" type="text" is="emby-input" />
<div class="fieldDescription">The api key used by your radarr instance</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="SonarrAPIKey">Sonarr API Key</label>
<input id="SonarrAPIKey" name="SonarrAPIKey" type="text" is="emby-input" />
<div class="fieldDescription">The api key used by your sonarr instance</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="DaysUnwatched">Days Unwatched</label>
<input id="DaysUnwatched" name="DaysUnwatched" type="number" is="emby-input" style="width: 20%;"/>
<div class="fieldDescription">How many days to wait before deleting unwatched media</div>
</div>
<!-- <div class="selectContainer">
<label class="selectLabel" for="Options">Several Options</label>
<select is="emby-select" id="Options" name="Options" class="emby-select-withcolor emby-select">
@@ -41,31 +56,37 @@
</div>
</div>
<script type="text/javascript">
var TemplateConfig = {
var MediaCleanerConfig = {
pluginUniqueId: 'fef007a8-3e8f-4aa8-a22e-486a387f4192'
};
document.querySelector('#TemplateConfigPage')
document.querySelector('#MediaCleanerConfigPage')
.addEventListener('pageshow', function() {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
ApiClient.getPluginConfiguration(MediaCleanerConfig.pluginUniqueId).then(function (config) {
// document.querySelector('#Options').value = config.Options;
// document.querySelector('#AnInteger').value = config.AnInteger;
// document.querySelector('#TrueFalseSetting').checked = config.TrueFalseSetting;
// document.querySelector('#AString').value = config.AString;
document.querySelector('#RadarrAPIKey').value = config.RadarrAPIKey;
document.querySelector('#SonarrAPIKey').value = config.SonarrAPIKey;
document.querySelector('#DaysUnwatched').value = config.DaysUnwatched;
Dashboard.hideLoadingMsg();
});
});
document.querySelector('#TemplateConfigForm')
document.querySelector('#MediaCleanerConfigForm')
.addEventListener('submit', function(e) {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
ApiClient.getPluginConfiguration(MediaCleanerConfig.pluginUniqueId).then(function (config) {
// config.Options = document.querySelector('#Options').value;
// config.AnInteger = document.querySelector('#AnInteger').value;
// config.TrueFalseSetting = document.querySelector('#TrueFalseSetting').checked;
// config.AString = document.querySelector('#AString').value;
ApiClient.updatePluginConfiguration(TemplateConfig.pluginUniqueId, config).then(function (result) {
config.RadarrAPIKey = document.querySelector('#RadarrAPIKey').value;
config.SonarrAPIKey = document.querySelector('#SonarrAPIKey').value;
config.DaysUnwatched = document.querySelector('#DaysUnwatched').value;
ApiClient.updatePluginConfiguration(MediaCleanerConfig.pluginUniqueId, config).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
});
});

View File

@@ -1,16 +0,0 @@
---
name: "MediaCleaner"
guid: "eb5d7894-8eef-4b36-aa6f-5d124e828ce1"
version: "1.0.0.0"
targetAbi: "10.9.0.0"
framework: "net8.0"
overview: "Short description about your plugin"
description: >
This is a longer description that can span more than one
line and include details about your plugin.
category: "General"
owner: "jellyfin"
artifacts:
- "Jellyfin.Plugin.Template.dll"
changelog: >
changelog