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:
@@ -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.)");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user