From 8fc8fc06223c567141289cde9ab00c66acfaa6e2 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 12 Jan 2019 14:46:17 +0100 Subject: Cleanup ImageProcessor --- Jellyfin.Server/Program.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Jellyfin.Server/Program.cs') diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index d077616199..fccc60176e 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -103,7 +103,7 @@ namespace Jellyfin.Server { appHost.Init(); - appHost.ImageProcessor.ImageEncoder = getImageEncoder(_logger, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo, appHost.LocalizationManager); + appHost.ImageProcessor.ImageEncoder = GetImageEncoder(_logger, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo, appHost.LocalizationManager); _logger.LogInformation("Running startup tasks"); @@ -256,13 +256,12 @@ namespace Jellyfin.Server } } - public static IImageEncoder getImageEncoder( + public static IImageEncoder GetImageEncoder( ILogger logger, IFileSystem fileSystem, StartupOptions startupOptions, Func httpClient, IApplicationPaths appPaths, - IEnvironmentInfo environment, ILocalizationManager localizationManager) { try -- cgit v1.2.3 From ca910325f3a0d8ce0cf71f2553d395e797b8c57d Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 20 Jan 2019 14:25:13 +0100 Subject: Remove unneeded fields --- Emby.Drawing/PercentPlayedDrawer.cs | 4 ++-- Emby.Drawing/PlayedIndicatorDrawer.cs | 18 ++---------------- Emby.Drawing/SkiaEncoder.cs | 11 ++++------- Emby.Drawing/UnplayedCountIndicator.cs | 18 ++---------------- Jellyfin.Server/Program.cs | 5 ++--- 5 files changed, 12 insertions(+), 44 deletions(-) (limited to 'Jellyfin.Server/Program.cs') diff --git a/Emby.Drawing/PercentPlayedDrawer.cs b/Emby.Drawing/PercentPlayedDrawer.cs index 3ab5f34bc3..52b4329e1e 100644 --- a/Emby.Drawing/PercentPlayedDrawer.cs +++ b/Emby.Drawing/PercentPlayedDrawer.cs @@ -4,11 +4,11 @@ using SkiaSharp; namespace Emby.Drawing { - public class PercentPlayedDrawer + public static class PercentPlayedDrawer { private const int IndicatorHeight = 8; - public void Process(SKCanvas canvas, ImageSize imageSize, double percent) + public static void Process(SKCanvas canvas, ImageSize imageSize, double percent) { using (var paint = new SKPaint()) { diff --git a/Emby.Drawing/PlayedIndicatorDrawer.cs b/Emby.Drawing/PlayedIndicatorDrawer.cs index 92a164a5fe..a82398fa53 100644 --- a/Emby.Drawing/PlayedIndicatorDrawer.cs +++ b/Emby.Drawing/PlayedIndicatorDrawer.cs @@ -1,27 +1,13 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Net; using MediaBrowser.Model.Drawing; -using MediaBrowser.Model.IO; using SkiaSharp; namespace Emby.Drawing { - public class PlayedIndicatorDrawer + public static class PlayedIndicatorDrawer { private const int OffsetFromTopRightCorner = 38; - private readonly IApplicationPaths _appPaths; - private readonly IHttpClient _iHttpClient; - private readonly IFileSystem _fileSystem; - - public PlayedIndicatorDrawer(IApplicationPaths appPaths, IHttpClient iHttpClient, IFileSystem fileSystem) - { - _appPaths = appPaths; - _iHttpClient = iHttpClient; - _fileSystem = fileSystem; - } - - public void DrawPlayedIndicator(SKCanvas canvas, ImageSize imageSize) + public static void DrawPlayedIndicator(SKCanvas canvas, ImageSize imageSize) { var x = imageSize.Width - OffsetFromTopRightCorner; diff --git a/Emby.Drawing/SkiaEncoder.cs b/Emby.Drawing/SkiaEncoder.cs index dc571f4a04..601ab18958 100644 --- a/Emby.Drawing/SkiaEncoder.cs +++ b/Emby.Drawing/SkiaEncoder.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using System.Reflection; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Net; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Extensions; using MediaBrowser.Model.Drawing; @@ -19,15 +18,13 @@ namespace Emby.Drawing { private readonly ILogger _logger; private static IApplicationPaths _appPaths; - private readonly Func _httpClientFactory; private readonly IFileSystem _fileSystem; private static ILocalizationManager _localizationManager; - public SkiaEncoder(ILogger logger, IApplicationPaths appPaths, Func httpClientFactory, IFileSystem fileSystem, ILocalizationManager localizationManager) + public SkiaEncoder(ILogger logger, IApplicationPaths appPaths, IFileSystem fileSystem, ILocalizationManager localizationManager) { _logger = logger; _appPaths = appPaths; - _httpClientFactory = httpClientFactory; _fileSystem = fileSystem; _localizationManager = localizationManager; @@ -636,16 +633,16 @@ namespace Emby.Drawing if (options.AddPlayedIndicator) { - new PlayedIndicatorDrawer(_appPaths, _httpClientFactory(), _fileSystem).DrawPlayedIndicator(canvas, currentImageSize); + PlayedIndicatorDrawer.DrawPlayedIndicator(canvas, currentImageSize); } else if (options.UnplayedCount.HasValue) { - new UnplayedCountIndicator(_appPaths, _httpClientFactory(), _fileSystem).DrawUnplayedCountIndicator(canvas, currentImageSize, options.UnplayedCount.Value); + UnplayedCountIndicator.DrawUnplayedCountIndicator(canvas, currentImageSize, options.UnplayedCount.Value); } if (options.PercentPlayed > 0) { - new PercentPlayedDrawer().Process(canvas, currentImageSize, options.PercentPlayed); + PercentPlayedDrawer.Process(canvas, currentImageSize, options.PercentPlayed); } } catch (Exception ex) diff --git a/Emby.Drawing/UnplayedCountIndicator.cs b/Emby.Drawing/UnplayedCountIndicator.cs index caa3e465be..16c084a21b 100644 --- a/Emby.Drawing/UnplayedCountIndicator.cs +++ b/Emby.Drawing/UnplayedCountIndicator.cs @@ -1,28 +1,14 @@ using System.Globalization; -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Net; using MediaBrowser.Model.Drawing; -using MediaBrowser.Model.IO; using SkiaSharp; namespace Emby.Drawing { - public class UnplayedCountIndicator + public static class UnplayedCountIndicator { private const int OffsetFromTopRightCorner = 38; - private readonly IApplicationPaths _appPaths; - private readonly IHttpClient _iHttpClient; - private readonly IFileSystem _fileSystem; - - public UnplayedCountIndicator(IApplicationPaths appPaths, IHttpClient iHttpClient, IFileSystem fileSystem) - { - _appPaths = appPaths; - _iHttpClient = iHttpClient; - _fileSystem = fileSystem; - } - - public void DrawUnplayedCountIndicator(SKCanvas canvas, ImageSize imageSize, int count) + public static void DrawUnplayedCountIndicator(SKCanvas canvas, ImageSize imageSize, int count) { var x = imageSize.Width - OffsetFromTopRightCorner; var text = count.ToString(CultureInfo.InvariantCulture); diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index fccc60176e..c7d14f0670 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -103,7 +103,7 @@ namespace Jellyfin.Server { appHost.Init(); - appHost.ImageProcessor.ImageEncoder = GetImageEncoder(_logger, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo, appHost.LocalizationManager); + appHost.ImageProcessor.ImageEncoder = GetImageEncoder(_logger, fileSystem, options, appPaths, appHost.LocalizationManager); _logger.LogInformation("Running startup tasks"); @@ -260,13 +260,12 @@ namespace Jellyfin.Server ILogger logger, IFileSystem fileSystem, StartupOptions startupOptions, - Func httpClient, IApplicationPaths appPaths, ILocalizationManager localizationManager) { try { - return new SkiaEncoder(logger, appPaths, httpClient, fileSystem, localizationManager); + return new SkiaEncoder(logger, appPaths, fileSystem, localizationManager); } catch (Exception ex) { -- cgit v1.2.3 From 7e4cc9f513ff583e7a8ecf596e61d33dd9ce41d9 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 20 Jan 2019 14:39:05 +0100 Subject: Touchup --- Emby.Drawing/ImageProcessor.cs | 10 +--------- Jellyfin.Server/Program.cs | 2 -- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'Jellyfin.Server/Program.cs') diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 625e566600..275b6354e2 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -230,14 +230,6 @@ namespace Emby.Drawing return (originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified); } - //ImageSize? originalImageSize = GetSavedImageSize(originalImagePath, dateModified); - //if (originalImageSize.HasValue && options.HasDefaultOptions(originalImagePath, originalImageSize.Value) && !autoOrient) - //{ - // // Just spit out the original file if all the options are default - // _logger.LogInformation("Returning original image {0}", originalImagePath); - // return new ValueTuple(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified); - //} - ImageSize newSize = ImageHelper.GetNewImageSize(options, null); int quality = options.Quality; @@ -674,7 +666,7 @@ namespace Emby.Drawing /// Type of the image. /// Index of the image. /// Task{EnhancedImage}. - private async Task ExecuteImageEnhancers(IEnumerable imageEnhancers, string inputPath, string outputPath, BaseItem item, ImageType imageType, int imageIndex) + private static async Task ExecuteImageEnhancers(IEnumerable imageEnhancers, string inputPath, string outputPath, BaseItem item, ImageType imageType, int imageIndex) { // Run the enhancers sequentially in order of priority foreach (var enhancer in imageEnhancers) diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index c7d14f0670..2441cebd01 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -14,11 +14,9 @@ using Emby.Server.Implementations.EnvironmentInfo; using Emby.Server.Implementations.IO; using Emby.Server.Implementations.Networking; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Net; using MediaBrowser.Controller.Drawing; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.IO; -using MediaBrowser.Model.System; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Serilog; -- cgit v1.2.3 From 7327bb91a3bffd1631ffc7368d82d05b286a7f4b Mon Sep 17 00:00:00 2001 From: Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> Date: Sun, 20 Jan 2019 20:48:24 -0500 Subject: Fix func name --- Jellyfin.Server/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Jellyfin.Server/Program.cs') diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 810bf9446d..0510548b56 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -254,7 +254,7 @@ namespace Jellyfin.Server } } - public static IImageEncoder getImageEncoder( + public static IImageEncoder GetImageEncoder( IFileSystem fileSystem, IApplicationPaths appPaths, ILocalizationManager localizationManager) -- cgit v1.2.3