diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs index f866655c0b..996dc08196 100644 --- a/Jellyfin.Api/Controllers/ImageController.cs +++ b/Jellyfin.Api/Controllers/ImageController.cs @@ -505,7 +505,6 @@ namespace Jellyfin.Api.Controllers /// Optional. Supply the cache tag from the item object to receive strong caching headers. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. /// Optional. The of the returned image. - /// Optional. Add a played indicator. /// Optional. Percent to render for the percent played overlay. /// Optional. Unplayed count overlay to render. /// Optional. Blur image. @@ -536,7 +535,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] string? tag, [FromQuery, ParameterObsolete] bool? cropWhitespace, [FromQuery] ImageFormat? format, - [FromQuery] bool? addPlayedIndicator, [FromQuery] double? percentPlayed, [FromQuery] int? unplayedCount, [FromQuery] int? blur, @@ -565,7 +563,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -589,7 +586,6 @@ namespace Jellyfin.Api.Controllers /// Optional. Supply the cache tag from the item object to receive strong caching headers. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. /// Optional. The of the returned image. - /// Optional. Add a played indicator. /// Optional. Percent to render for the percent played overlay. /// Optional. Unplayed count overlay to render. /// Optional. Blur image. @@ -620,7 +616,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] string? tag, [FromQuery, ParameterObsolete] bool? cropWhitespace, [FromQuery] ImageFormat? format, - [FromQuery] bool? addPlayedIndicator, [FromQuery] double? percentPlayed, [FromQuery] int? unplayedCount, [FromQuery] int? blur, @@ -648,7 +643,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -671,7 +665,6 @@ namespace Jellyfin.Api.Controllers /// Optional. Supply the cache tag from the item object to receive strong caching headers. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. /// Determines the output format of the image - original,gif,jpg,png. - /// Optional. Add a played indicator. /// Optional. Percent to render for the percent played overlay. /// Optional. Unplayed count overlay to render. /// Optional. Blur image. @@ -702,7 +695,6 @@ namespace Jellyfin.Api.Controllers [FromRoute, Required] string tag, [FromQuery, ParameterObsolete] bool? cropWhitespace, [FromRoute, Required] ImageFormat format, - [FromQuery] bool? addPlayedIndicator, [FromRoute, Required] double percentPlayed, [FromRoute, Required] int unplayedCount, [FromQuery] int? blur, @@ -731,7 +723,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -756,7 +747,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -787,7 +777,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -814,7 +803,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -839,7 +827,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -870,7 +857,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -897,7 +883,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -923,7 +908,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -954,7 +938,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -980,7 +963,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1005,7 +987,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -1036,7 +1017,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -1063,7 +1043,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1089,7 +1068,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -1120,7 +1098,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -1146,7 +1123,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1171,7 +1147,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -1202,7 +1177,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -1229,7 +1203,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1255,7 +1228,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -1286,7 +1258,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -1312,7 +1283,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1337,7 +1307,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -1368,7 +1337,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -1395,7 +1363,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1421,7 +1388,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -1452,7 +1418,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -1478,7 +1443,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1503,7 +1467,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -1534,7 +1497,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -1578,7 +1540,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1605,7 +1566,6 @@ namespace Jellyfin.Api.Controllers /// Width of box to fill. /// Height of box to fill. /// Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art. - /// Optional. Add a played indicator. /// Optional. Blur image. /// Optional. Apply a background color for transparent images. /// Optional. Apply a foreground layer on top of the image. @@ -1636,7 +1596,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -1679,7 +1638,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1924,7 +1882,6 @@ namespace Jellyfin.Api.Controllers int? quality, int? fillWidth, int? fillHeight, - bool? addPlayedIndicator, int? blur, string? backgroundColor, string? foregroundLayer, @@ -1940,7 +1897,6 @@ namespace Jellyfin.Api.Controllers else if (percentPlayed.Value >= 100) { percentPlayed = null; - addPlayedIndicator = true; } } @@ -1997,7 +1953,6 @@ namespace Jellyfin.Api.Controllers FillWidth = fillWidth, Quality = quality ?? 100, Width = width, - AddPlayedIndicator = addPlayedIndicator ?? false, PercentPlayed = percentPlayed ?? 0, UnplayedCount = unplayedCount, Blur = blur, diff --git a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs index 11e6633011..7912c5e87e 100644 --- a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs +++ b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs @@ -42,8 +42,6 @@ namespace MediaBrowser.Controller.Drawing public IReadOnlyCollection SupportedOutputFormats { get; set; } - public bool AddPlayedIndicator { get; set; } - public int? UnplayedCount { get; set; } public int? Blur { get; set; } @@ -111,7 +109,6 @@ namespace MediaBrowser.Controller.Drawing { return (Quality >= 90) && IsFormatSupported(originalImagePath) && - !AddPlayedIndicator && PercentPlayed.Equals(0) && !UnplayedCount.HasValue && !Blur.HasValue && diff --git a/MediaBrowser.Model/Dto/ImageOptions.cs b/MediaBrowser.Model/Dto/ImageOptions.cs deleted file mode 100644 index 3f4405f1e5..0000000000 --- a/MediaBrowser.Model/Dto/ImageOptions.cs +++ /dev/null @@ -1,111 +0,0 @@ -#nullable disable -using MediaBrowser.Model.Drawing; -using MediaBrowser.Model.Entities; - -namespace MediaBrowser.Model.Dto -{ - /// - /// Class ImageOptions. - /// - public class ImageOptions - { - /// - /// Initializes a new instance of the class. - /// - public ImageOptions() - { - EnableImageEnhancers = true; - } - - /// - /// Gets or sets the type of the image. - /// - /// The type of the image. - public ImageType ImageType { get; set; } - - /// - /// Gets or sets the index of the image. - /// - /// The index of the image. - public int? ImageIndex { get; set; } - - /// - /// Gets or sets the width. - /// - /// The width. - public int? Width { get; set; } - - /// - /// Gets or sets the height. - /// - /// The height. - public int? Height { get; set; } - - /// - /// Gets or sets the width of the max. - /// - /// The width of the max. - public int? MaxWidth { get; set; } - - /// - /// Gets or sets the height of the max. - /// - /// The height of the max. - public int? MaxHeight { get; set; } - - /// - /// Gets or sets the quality. - /// - /// The quality. - public int? Quality { get; set; } - - /// - /// Gets or sets the image tag. - /// If set this will result in strong, unconditional response caching. - /// - /// The hash. - public string Tag { get; set; } - - /// - /// Gets or sets a value indicating whether [crop whitespace]. - /// - /// null if [crop whitespace] contains no value, true if [crop whitespace]; otherwise, false. - public bool? CropWhitespace { get; set; } - - /// - /// Gets or sets a value indicating whether [enable image enhancers]. - /// - /// true if [enable image enhancers]; otherwise, false. - public bool EnableImageEnhancers { get; set; } - - /// - /// Gets or sets the format. - /// - /// The format. - public ImageFormat? Format { get; set; } - - /// - /// Gets or sets a value indicating whether [add played indicator]. - /// - /// true if [add played indicator]; otherwise, false. - public bool AddPlayedIndicator { get; set; } - - /// - /// Gets or sets the percent played. - /// - /// The percent played. - public int? PercentPlayed { get; set; } - - /// - /// Gets or sets the un played count. - /// - /// The un played count. - public int? UnPlayedCount { get; set; } - - /// - /// Gets or sets the color of the background. - /// - /// The color of the background. - public string BackgroundColor { get; set; } - } -} diff --git a/src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs b/src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs deleted file mode 100644 index 5bb42fb99e..0000000000 --- a/src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs +++ /dev/null @@ -1,47 +0,0 @@ -using MediaBrowser.Model.Drawing; -using SkiaSharp; - -namespace Jellyfin.Drawing.Skia; - -/// -/// Static helper class for drawing 'played' indicators. -/// -public static class PlayedIndicatorDrawer -{ - private const int OffsetFromTopRightCorner = 38; - - /// - /// Draw a 'played' indicator in the top right corner of a canvas. - /// - /// The canvas to draw the indicator on. - /// - /// The dimensions of the image to draw the indicator on. The width is used to determine the x-position of the - /// indicator. - /// - 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); - } -} diff --git a/src/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/src/Jellyfin.Drawing.Skia/SkiaEncoder.cs index ddb8a98d4d..6da77ad959 100644 --- a/src/Jellyfin.Drawing.Skia/SkiaEncoder.cs +++ b/src/Jellyfin.Drawing.Skia/SkiaEncoder.cs @@ -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); } diff --git a/src/Jellyfin.Drawing/ImageProcessor.cs b/src/Jellyfin.Drawing/ImageProcessor.cs index 353a27b254..533baba4fa 100644 --- a/src/Jellyfin.Drawing/ImageProcessor.cs +++ b/src/Jellyfin.Drawing/ImageProcessor.cs @@ -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=");