Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Asp.Net Core Web Api #26

Merged
merged 2 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions Jellyfin.Plugin.TMDbBoxSets/Api/TMDbBoxSetsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System.Net.Mime;
using MediaBrowser.Controller.Collections;
using MediaBrowser.Controller.Library;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace Jellyfin.Plugin.TMDbBoxSets.Api
{
/// <summary>
/// The TMDb collections api controller.
/// </summary>
[ApiController]
[Authorize(Policy = "DefaultAuthorization")]
[Route("[controller]")]
[Produces(MediaTypeNames.Application.Json)]
public class TMDbBoxSetsController : ControllerBase
{
private readonly TMDbBoxSetManager _tmDbBoxSetManager;
private readonly ILogger<TMDbBoxSetsController> _logger;

/// <summary>
/// Initializes a new instance of <see cref="TMDbBoxSetsController"/>.
/// </summary>
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
/// <param name="collectionManager">Instance of the <see cref="ICollectionManager"/> interface.</param>
/// <param name="logger">Instance of the <see cref="ILogger{TMDbBoxSetsController}"/> interface.</param>
/// <param name="boxsetLogger">Instance of the <see cref="ILogger{TMDbBoxSetManager}"/> interface.</param>
public TMDbBoxSetsController(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger<TMDbBoxSetsController> logger, ILogger<TMDbBoxSetManager> boxsetLogger)
{
_tmDbBoxSetManager = new TMDbBoxSetManager(libraryManager, collectionManager, boxsetLogger);
_logger = logger;
}

/// <summary>
/// Scans all movies and creates box sets.
/// </summary>
/// <reponse code="204">Library scan and box set creation started successfully. </response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Refresh")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult RefreshMetadataRequest()
{
_logger.LogInformation("Starting a manual refresh of TMDb collections");
_tmDbBoxSetManager.ScanLibrary(null);
_logger.LogInformation("Completed refresh of TMDb collections");
return NoContent();
}
}
}
33 changes: 0 additions & 33 deletions Jellyfin.Plugin.TMDbBoxSets/Api/TMDbCollectionsService.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<ItemGroup>
<PackageReference Include="Jellyfin.Controller" Version="10.*-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down