From 0af5e600946231df73f1783330ad8cd0bbbed2ee Mon Sep 17 00:00:00 2001 From: Joe Rogers <1337joe@gmail.com> Date: Mon, 22 Nov 2021 21:08:07 +0100 Subject: Address review comments Store null instead of calculating scaled image sizes. Add endpoint to provide TMDb image size options. --- .../Plugins/Tmdb/Api/TmdbController.cs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 MediaBrowser.Providers/Plugins/Tmdb/Api/TmdbController.cs (limited to 'MediaBrowser.Providers/Plugins/Tmdb/Api/TmdbController.cs') diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Api/TmdbController.cs b/MediaBrowser.Providers/Plugins/Tmdb/Api/TmdbController.cs new file mode 100644 index 000000000..0bab7c3ca --- /dev/null +++ b/MediaBrowser.Providers/Plugins/Tmdb/Api/TmdbController.cs @@ -0,0 +1,41 @@ +using System.Net.Mime; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using TMDbLib.Objects.General; + +namespace MediaBrowser.Providers.Plugins.Tmdb.Api +{ + /// + /// The TMDb api controller. + /// + [ApiController] + [Authorize(Policy = "DefaultAuthorization")] + [Route("[controller]")] + [Produces(MediaTypeNames.Application.Json)] + public class TmdbController : ControllerBase + { + private readonly TmdbClientManager _tmdbClientManager; + + /// + /// Initializes a new instance of the class. + /// + /// The TMDb client manager. + public TmdbController(TmdbClientManager tmdbClientManager) + { + _tmdbClientManager = tmdbClientManager; + } + + /// + /// Gets the TMDb image configuration options. + /// + /// The image portion of the TMDb client configuration. + [HttpGet("ClientConfiguration")] + [ProducesResponseType(StatusCodes.Status200OK)] + public async Task TmdbClientConfiguration() + { + return (await _tmdbClientManager.GetClientConfiguration().ConfigureAwait(false)).Images; + } + } +} -- cgit v1.2.3