Converted StaleMediaTask to StaleMediaScanner for use in plugin home page. Also added a generic Media Info class that can be filtered to return the data you desire.

This commit is contained in:
2026-01-25 14:52:47 -07:00
parent 66716a9bc9
commit 04ef815a9b
10 changed files with 213 additions and 111 deletions

View File

@@ -1,22 +1,32 @@
using Jellyfin.Plugin.MediaCleaner.Data;
using Jellyfin.Plugin.MediaCleaner;
using Jellyfin.Plugin.MediaCleaner.Models;
using Microsoft.AspNetCore.Mvc;
using Jellyfin.Plugin.MediaCleaner.Configuration;
namespace Jellyfin.Plugin.MediaCleaner.Controllers;
[Route("mediacleaner/state")]
public class StateController : Controller
public class StateController(MediaCleanerState state) : Controller
{
private readonly PluginState _state;
public StateController(PluginState state) => _state = state;
private readonly MediaCleanerState _state = state;
private static PluginConfiguration Configuration =>
Plugin.Instance!.Configuration;
[HttpGet]
public IActionResult Get() => Ok(_state.GetSeriesInfo());
[HttpGet("getSeriesInfo")]
public IActionResult GetSeriesInfo() => Ok(_state.GetSeriesInfo());
[HttpPost("add")]
public IActionResult AddSeriesInfo([FromBody] SeriesInfo seriesInfo)
{
_state.AddSeriesInfo(seriesInfo);
return Ok();
}
[HttpGet("getMovieInfo")]
public IActionResult GetMovieInfo() => Ok(_state.GetMovieInfo());
[HttpGet("updateState")]
public IActionResult GetUpdateState() => Ok(_state.UpdateState());
[HttpGet("getMoviesTitle")]
public IActionResult GetMoviesTitle() =>
Ok($"Stale Movies (Unwatched for and created over {Configuration.StaleMediaCutoff} Days ago.)");
[HttpGet("getSeriesTitle")]
public IActionResult GetSeriesTitle() =>
Ok($"Stale Series (Unwatched for and created over {Configuration.StaleMediaCutoff} Days ago.)");
}