Remove unneeded fields
This commit is contained in:
parent
8fc8fc0622
commit
ca910325f3
|
@ -4,11 +4,11 @@ using SkiaSharp;
|
||||||
|
|
||||||
namespace Emby.Drawing
|
namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
public class PercentPlayedDrawer
|
public static class PercentPlayedDrawer
|
||||||
{
|
{
|
||||||
private const int IndicatorHeight = 8;
|
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())
|
using (var paint = new SKPaint())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,27 +1,13 @@
|
||||||
using MediaBrowser.Common.Configuration;
|
|
||||||
using MediaBrowser.Common.Net;
|
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Emby.Drawing
|
namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
public class PlayedIndicatorDrawer
|
public static class PlayedIndicatorDrawer
|
||||||
{
|
{
|
||||||
private const int OffsetFromTopRightCorner = 38;
|
private const int OffsetFromTopRightCorner = 38;
|
||||||
|
|
||||||
private readonly IApplicationPaths _appPaths;
|
public static void DrawPlayedIndicator(SKCanvas canvas, ImageSize imageSize)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
var x = imageSize.Width - OffsetFromTopRightCorner;
|
var x = imageSize.Width - OffsetFromTopRightCorner;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Net;
|
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Controller.Extensions;
|
using MediaBrowser.Controller.Extensions;
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
|
@ -19,15 +18,13 @@ namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private static IApplicationPaths _appPaths;
|
private static IApplicationPaths _appPaths;
|
||||||
private readonly Func<IHttpClient> _httpClientFactory;
|
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private static ILocalizationManager _localizationManager;
|
private static ILocalizationManager _localizationManager;
|
||||||
|
|
||||||
public SkiaEncoder(ILogger logger, IApplicationPaths appPaths, Func<IHttpClient> httpClientFactory, IFileSystem fileSystem, ILocalizationManager localizationManager)
|
public SkiaEncoder(ILogger logger, IApplicationPaths appPaths, IFileSystem fileSystem, ILocalizationManager localizationManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
_httpClientFactory = httpClientFactory;
|
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_localizationManager = localizationManager;
|
_localizationManager = localizationManager;
|
||||||
|
|
||||||
|
@ -636,16 +633,16 @@ namespace Emby.Drawing
|
||||||
|
|
||||||
if (options.AddPlayedIndicator)
|
if (options.AddPlayedIndicator)
|
||||||
{
|
{
|
||||||
new PlayedIndicatorDrawer(_appPaths, _httpClientFactory(), _fileSystem).DrawPlayedIndicator(canvas, currentImageSize);
|
PlayedIndicatorDrawer.DrawPlayedIndicator(canvas, currentImageSize);
|
||||||
}
|
}
|
||||||
else if (options.UnplayedCount.HasValue)
|
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)
|
if (options.PercentPlayed > 0)
|
||||||
{
|
{
|
||||||
new PercentPlayedDrawer().Process(canvas, currentImageSize, options.PercentPlayed);
|
PercentPlayedDrawer.Process(canvas, currentImageSize, options.PercentPlayed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -1,28 +1,14 @@
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using MediaBrowser.Common.Configuration;
|
|
||||||
using MediaBrowser.Common.Net;
|
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Emby.Drawing
|
namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
public class UnplayedCountIndicator
|
public static class UnplayedCountIndicator
|
||||||
{
|
{
|
||||||
private const int OffsetFromTopRightCorner = 38;
|
private const int OffsetFromTopRightCorner = 38;
|
||||||
|
|
||||||
private readonly IApplicationPaths _appPaths;
|
public static void DrawUnplayedCountIndicator(SKCanvas canvas, ImageSize imageSize, int count)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
var x = imageSize.Width - OffsetFromTopRightCorner;
|
var x = imageSize.Width - OffsetFromTopRightCorner;
|
||||||
var text = count.ToString(CultureInfo.InvariantCulture);
|
var text = count.ToString(CultureInfo.InvariantCulture);
|
||||||
|
|
|
@ -103,7 +103,7 @@ namespace Jellyfin.Server
|
||||||
{
|
{
|
||||||
appHost.Init();
|
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");
|
_logger.LogInformation("Running startup tasks");
|
||||||
|
|
||||||
|
@ -260,13 +260,12 @@ namespace Jellyfin.Server
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
StartupOptions startupOptions,
|
StartupOptions startupOptions,
|
||||||
Func<IHttpClient> httpClient,
|
|
||||||
IApplicationPaths appPaths,
|
IApplicationPaths appPaths,
|
||||||
ILocalizationManager localizationManager)
|
ILocalizationManager localizationManager)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new SkiaEncoder(logger, appPaths, httpClient, fileSystem, localizationManager);
|
return new SkiaEncoder(logger, appPaths, fileSystem, localizationManager);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user