Merge pull request #6783 from 1337joe/purge-screenshot

This commit is contained in:
Bond-009 2021-11-06 23:07:11 +01:00 committed by GitHub
commit 83859a1e6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 38 deletions

View File

@ -755,15 +755,6 @@ namespace Emby.Server.Implementations.Dto
dto.BackdropImageTags = GetTagsAndFillBlurhashes(dto, item, ImageType.Backdrop, backdropLimit);
}
if (options.ContainsField(ItemFields.ScreenshotImageTags))
{
var screenshotLimit = options.GetImageLimit(ImageType.Screenshot);
if (screenshotLimit > 0)
{
dto.ScreenshotImageTags = GetTagsAndFillBlurhashes(dto, item, ImageType.Screenshot, screenshotLimit);
}
}
if (options.ContainsField(ItemFields.Genres))
{
dto.Genres = item.Genres;

View File

@ -2577,7 +2577,7 @@ namespace MediaBrowser.Controller.Entities
public bool AllowsMultipleImages(ImageType type)
{
return type == ImageType.Backdrop || type == ImageType.Screenshot || type == ImageType.Chapter;
return type == ImageType.Backdrop || type == ImageType.Chapter;
}
public Task SwapImagesAsync(ImageType type, int index1, int index2)

View File

@ -1,3 +1,5 @@
using System;
namespace MediaBrowser.Model.Entities
{
/// <summary>
@ -48,6 +50,7 @@ namespace MediaBrowser.Model.Entities
/// <summary>
/// The screenshot.
/// </summary>
[Obsolete("Screenshot image type is no longer used.")]
Screenshot = 8,
/// <summary>

View File

@ -1,5 +1,7 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Querying
{
/// <summary>
@ -143,6 +145,7 @@ namespace MediaBrowser.Model.Querying
/// <summary>
/// The screenshot image tags.
/// </summary>
[Obsolete("Screenshot image type is no longer used.")]
ScreenshotImageTags,
SeriesPrimaryImage,

View File

@ -439,9 +439,6 @@ namespace MediaBrowser.Providers.Manager
case ImageType.Backdrop:
filename = GetBackdropSaveFilename(item.GetImages(type), "backdrop", "backdrop", imageIndex);
break;
case ImageType.Screenshot:
filename = GetBackdropSaveFilename(item.GetImages(type), "screenshot", "screenshot", imageIndex);
break;
default:
filename = type.ToString().ToLowerInvariant();
break;

View File

@ -109,12 +109,6 @@ namespace MediaBrowser.Providers.Manager
oldBackdropImages = item.GetImages(ImageType.Backdrop).ToArray();
}
var oldScreenshotImages = Array.Empty<ItemImageInfo>();
if (refreshOptions.IsReplacingImage(ImageType.Screenshot))
{
oldScreenshotImages = item.GetImages(ImageType.Screenshot).ToArray();
}
var result = new RefreshResult { UpdateType = ItemUpdateType.None };
var typeName = item.GetType().Name;
@ -122,14 +116,13 @@ namespace MediaBrowser.Providers.Manager
// track library limits, adding buffer to allow lazy replacing of current images
var backdropLimit = typeOptions.GetLimit(ImageType.Backdrop) + oldBackdropImages.Length;
var screenshotLimit = typeOptions.GetLimit(ImageType.Screenshot) + oldScreenshotImages.Length;
var downloadedImages = new List<ImageType>();
foreach (var provider in providers)
{
if (provider is IRemoteImageProvider remoteProvider)
{
await RefreshFromProvider(item, remoteProvider, refreshOptions, typeOptions, backdropLimit, screenshotLimit, downloadedImages, result, cancellationToken).ConfigureAwait(false);
await RefreshFromProvider(item, remoteProvider, refreshOptions, typeOptions, backdropLimit, downloadedImages, result, cancellationToken).ConfigureAwait(false);
continue;
}
@ -145,11 +138,6 @@ namespace MediaBrowser.Providers.Manager
PruneImages(item, oldBackdropImages);
}
if (oldScreenshotImages.Length > 0 && oldScreenshotImages.Length < item.GetImages(ImageType.Screenshot).Count())
{
PruneImages(item, oldScreenshotImages);
}
return result;
}
@ -243,9 +231,8 @@ namespace MediaBrowser.Providers.Manager
/// <param name="images">The images.</param>
/// <param name="savedOptions">The saved options.</param>
/// <param name="backdropLimit">The backdrop limit.</param>
/// <param name="screenshotLimit">The screenshot limit.</param>
/// <returns><c>true</c> if the specified item contains images; otherwise, <c>false</c>.</returns>
private bool ContainsImages(BaseItem item, List<ImageType> images, TypeOptions savedOptions, int backdropLimit, int screenshotLimit)
private bool ContainsImages(BaseItem item, List<ImageType> images, TypeOptions savedOptions, int backdropLimit)
{
// Using .Any causes the creation of a DisplayClass aka. variable capture
for (var i = 0; i < _singularImages.Length; i++)
@ -262,11 +249,6 @@ namespace MediaBrowser.Providers.Manager
return false;
}
if (images.Contains(ImageType.Screenshot) && item.GetImages(ImageType.Screenshot).Count() < screenshotLimit)
{
return false;
}
return true;
}
@ -278,7 +260,6 @@ namespace MediaBrowser.Providers.Manager
/// <param name="refreshOptions">The refresh options.</param>
/// <param name="savedOptions">The saved options.</param>
/// <param name="backdropLimit">The backdrop limit.</param>
/// <param name="screenshotLimit">The screenshot limit.</param>
/// <param name="downloadedImages">The downloaded images.</param>
/// <param name="result">The result.</param>
/// <param name="cancellationToken">The cancellation token.</param>
@ -289,7 +270,6 @@ namespace MediaBrowser.Providers.Manager
ImageRefreshOptions refreshOptions,
TypeOptions savedOptions,
int backdropLimit,
int screenshotLimit,
ICollection<ImageType> downloadedImages,
RefreshResult result,
CancellationToken cancellationToken)
@ -303,7 +283,7 @@ namespace MediaBrowser.Providers.Manager
if (!refreshOptions.ReplaceAllImages &&
refreshOptions.ReplaceImages.Length == 0 &&
ContainsImages(item, provider.GetSupportedImages(item).ToList(), savedOptions, backdropLimit, screenshotLimit))
ContainsImages(item, provider.GetSupportedImages(item).ToList(), savedOptions, backdropLimit))
{
return;
}

View File

@ -207,10 +207,8 @@ namespace Jellyfin.Providers.Tests.Manager
[Theory]
[InlineData(ImageType.Primary, 1, false)]
[InlineData(ImageType.Backdrop, 2, false)]
[InlineData(ImageType.Screenshot, 2, false)]
[InlineData(ImageType.Primary, 1, true)]
[InlineData(ImageType.Backdrop, 2, true)]
[InlineData(ImageType.Screenshot, 2, true)]
public async void RefreshImages_PopulatedItemPopulatedProviderDynamic_UpdatesImagesIfForced(ImageType imageType, int imageCount, bool forceRefresh)
{
var item = GetItemWithImages(imageType, imageCount, false);