aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/ImageController.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2022-01-10 08:25:46 -0700
committerCody Robibero <cody@robibe.ro>2022-01-10 08:26:30 -0700
commitecb73168b34e3d58dff186b6d90fb4bdd192e24a (patch)
treea973f42d5e77239077e967eef28105a30ada3fe3 /Jellyfin.Api/Controllers/ImageController.cs
parent360fd70fc74325008b031c9a1155b9b76724866d (diff)
Suggestions from review
Diffstat (limited to 'Jellyfin.Api/Controllers/ImageController.cs')
-rw-r--r--Jellyfin.Api/Controllers/ImageController.cs21
1 files changed, 11 insertions, 10 deletions
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs
index 6d34ca770..b44a21d03 100644
--- a/Jellyfin.Api/Controllers/ImageController.cs
+++ b/Jellyfin.Api/Controllers/ImageController.cs
@@ -48,7 +48,7 @@ namespace Jellyfin.Api.Controllers
private readonly ILogger<ImageController> _logger;
private readonly IServerConfigurationManager _serverConfigurationManager;
private readonly IApplicationPaths _appPaths;
- private readonly IImageGenerator _imageGenerator;
+ private readonly IImageEncoder _imageEncoder;
/// <summary>
/// Initializes a new instance of the <see cref="ImageController"/> class.
@@ -62,7 +62,7 @@ namespace Jellyfin.Api.Controllers
/// <param name="logger">Instance of the <see cref="ILogger{ImageController}"/> interface.</param>
/// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
/// <param name="appPaths">Instance of the <see cref="IApplicationPaths"/> interface.</param>
- /// <param name="imageGenerator">Instance of the <see cref="IImageGenerator"/> interface.</param>
+ /// <param name="imageEncoder">Instance of the <see cref="IImageEncoder"/> interface.</param>
public ImageController(
IUserManager userManager,
ILibraryManager libraryManager,
@@ -73,7 +73,7 @@ namespace Jellyfin.Api.Controllers
ILogger<ImageController> logger,
IServerConfigurationManager serverConfigurationManager,
IApplicationPaths appPaths,
- IImageGenerator imageGenerator)
+ IImageEncoder imageEncoder)
{
_userManager = userManager;
_libraryManager = libraryManager;
@@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllers
_logger = logger;
_serverConfigurationManager = serverConfigurationManager;
_appPaths = appPaths;
- _imageGenerator = imageGenerator;
+ _imageEncoder = imageEncoder;
}
/// <summary>
@@ -1737,19 +1737,20 @@ namespace Jellyfin.Api.Controllers
[FromQuery] string? foregroundLayer,
[FromQuery, Range(0, 100)] int quality = 90)
{
- string splashscreenPath;
var brandingOptions = _serverConfigurationManager.GetConfiguration<BrandingOptions>("branding");
- if (!string.IsNullOrWhiteSpace(brandingOptions.SplashscreenLocation))
+ string splashscreenPath;
+
+ if (!string.IsNullOrWhiteSpace(brandingOptions.SplashscreenLocation)
+ && System.IO.File.Exists(brandingOptions.SplashscreenLocation))
{
- splashscreenPath = brandingOptions.SplashscreenLocation!;
+ splashscreenPath = brandingOptions.SplashscreenLocation;
}
else
{
splashscreenPath = Path.Combine(_appPaths.DataPath, "splashscreen.webp");
-
- if (!System.IO.File.Exists(splashscreenPath) && _imageGenerator.GetSupportedImages().Contains(GeneratedImageType.Splashscreen))
+ if (!System.IO.File.Exists(splashscreenPath))
{
- _imageGenerator.Generate(GeneratedImageType.Splashscreen, splashscreenPath);
+ return NotFound();
}
}