mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-26 12:07:01 +00:00
Remove ability to add a played indicator to images (#9186)
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Jellyfin.Drawing.Skia;
|
||||
|
||||
/// <summary>
|
||||
/// Static helper class for drawing 'played' indicators.
|
||||
/// </summary>
|
||||
public static class PlayedIndicatorDrawer
|
||||
{
|
||||
private const int OffsetFromTopRightCorner = 38;
|
||||
|
||||
/// <summary>
|
||||
/// Draw a 'played' indicator in the top right corner of a canvas.
|
||||
/// </summary>
|
||||
/// <param name="canvas">The canvas to draw the indicator on.</param>
|
||||
/// <param name="imageSize">
|
||||
/// The dimensions of the image to draw the indicator on. The width is used to determine the x-position of the
|
||||
/// indicator.
|
||||
/// </param>
|
||||
public static void DrawPlayedIndicator(SKCanvas canvas, ImageDimensions imageSize)
|
||||
{
|
||||
var x = imageSize.Width - OffsetFromTopRightCorner;
|
||||
|
||||
using var paint = new SKPaint
|
||||
{
|
||||
Color = SKColor.Parse("#CC00A4DC"),
|
||||
Style = SKPaintStyle.Fill
|
||||
};
|
||||
|
||||
canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
|
||||
|
||||
paint.Color = new SKColor(255, 255, 255, 255);
|
||||
paint.TextSize = 30;
|
||||
paint.IsAntialias = true;
|
||||
|
||||
// or:
|
||||
// var emojiChar = 0x1F680;
|
||||
const string Text = "✔️";
|
||||
var emojiChar = StringUtilities.GetUnicodeCharacterCode(Text, SKTextEncoding.Utf32);
|
||||
|
||||
// ask the font manager for a font with that character
|
||||
paint.Typeface = SKFontManager.Default.MatchCharacter(emojiChar);
|
||||
|
||||
canvas.DrawText(Text, (float)x - 12, OffsetFromTopRightCorner + 12, paint);
|
||||
}
|
||||
}
|
||||
@@ -399,7 +399,7 @@ public class SkiaEncoder : IImageEncoder
|
||||
var hasBackgroundColor = !string.IsNullOrWhiteSpace(options.BackgroundColor);
|
||||
var hasForegroundColor = !string.IsNullOrWhiteSpace(options.ForegroundLayer);
|
||||
var blur = options.Blur ?? 0;
|
||||
var hasIndicator = options.AddPlayedIndicator || options.UnplayedCount.HasValue || !options.PercentPlayed.Equals(0);
|
||||
var hasIndicator = options.UnplayedCount.HasValue || !options.PercentPlayed.Equals(0);
|
||||
|
||||
using var bitmap = GetBitmap(inputPath, autoOrient, orientation);
|
||||
if (bitmap is null)
|
||||
@@ -522,11 +522,7 @@ public class SkiaEncoder : IImageEncoder
|
||||
{
|
||||
var currentImageSize = new ImageDimensions(imageWidth, imageHeight);
|
||||
|
||||
if (options.AddPlayedIndicator)
|
||||
{
|
||||
PlayedIndicatorDrawer.DrawPlayedIndicator(canvas, currentImageSize);
|
||||
}
|
||||
else if (options.UnplayedCount.HasValue)
|
||||
if (options.UnplayedCount.HasValue)
|
||||
{
|
||||
UnplayedCountIndicator.DrawUnplayedCountIndicator(canvas, currentImageSize, options.UnplayedCount.Value);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ public sealed class ImageProcessor : IImageProcessor, IDisposable
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IServerApplicationPaths _appPaths;
|
||||
private readonly IImageEncoder _imageEncoder;
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
|
||||
private readonly SemaphoreSlim _parallelEncodingLimit;
|
||||
|
||||
@@ -64,7 +63,6 @@ public sealed class ImageProcessor : IImageProcessor, IDisposable
|
||||
_logger = logger;
|
||||
_fileSystem = fileSystem;
|
||||
_imageEncoder = imageEncoder;
|
||||
_mediaEncoder = mediaEncoder;
|
||||
_appPaths = appPaths;
|
||||
|
||||
var semaphoreCount = config.Configuration.ParallelImageEncodingLimit;
|
||||
@@ -202,7 +200,6 @@ public sealed class ImageProcessor : IImageProcessor, IDisposable
|
||||
quality,
|
||||
dateModified,
|
||||
outputFormat,
|
||||
options.AddPlayedIndicator,
|
||||
options.PercentPlayed,
|
||||
options.UnplayedCount,
|
||||
options.Blur,
|
||||
@@ -295,7 +292,6 @@ public sealed class ImageProcessor : IImageProcessor, IDisposable
|
||||
int quality,
|
||||
DateTime dateModified,
|
||||
ImageFormat format,
|
||||
bool addPlayedIndicator,
|
||||
double percentPlayed,
|
||||
int? unwatchedCount,
|
||||
int? blur,
|
||||
@@ -350,11 +346,6 @@ public sealed class ImageProcessor : IImageProcessor, IDisposable
|
||||
filename.Append(fillHeight.Value);
|
||||
}
|
||||
|
||||
if (addPlayedIndicator)
|
||||
{
|
||||
filename.Append(",pl=true");
|
||||
}
|
||||
|
||||
if (percentPlayed > 0)
|
||||
{
|
||||
filename.Append(",p=");
|
||||
|
||||
Reference in New Issue
Block a user