Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused IHasScreenshots interface #6769

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions MediaBrowser.Controller/Entities/IHasScreenshots.cs

This file was deleted.

10 changes: 0 additions & 10 deletions MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,6 @@ private void PopulateImages(BaseItem item, List<LocalImageInfo> images, List<Fil
{
PopulateBackdrops(item, images, files, imagePrefix, isInMixedFolder);
}

if (item is IHasScreenshots)
{
PopulateScreenshots(images, files, imagePrefix, isInMixedFolder);
}
}

private void PopulatePrimaryImages(BaseItem item, List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, bool isInMixedFolder)
Expand Down Expand Up @@ -363,11 +358,6 @@ private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo>
}));
}

private void PopulateScreenshots(List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, bool isInMixedFolder)
{
PopulateBackdrops(images, files, imagePrefix, "screenshot", "screenshot", isInMixedFolder, ImageType.Screenshot);
}

private void PopulateBackdrops(List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, string firstFileName, string subsequentFileNamePrefix, bool isInMixedFolder, ImageType type)
{
AddImage(files, images, imagePrefix + firstFileName, type);
Expand Down
11 changes: 0 additions & 11 deletions MediaBrowser.Providers/Manager/ItemImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,6 @@ private bool ContainsImages(BaseItem item, List<ImageType> images, TypeOptions s

minWidth = savedOptions.GetMinWidth(ImageType.Backdrop);
await DownloadMultiImages(item, ImageType.Backdrop, refreshOptions, backdropLimit, provider, result, list, minWidth, cancellationToken).ConfigureAwait(false);

if (item is IHasScreenshots)
{
minWidth = savedOptions.GetMinWidth(ImageType.Screenshot);
await DownloadMultiImages(item, ImageType.Screenshot, refreshOptions, screenshotLimit, provider, result, list, minWidth, cancellationToken).ConfigureAwait(false);
}
}
catch (OperationCanceledException)
{
Expand Down Expand Up @@ -438,11 +432,6 @@ public bool MergeImages(BaseItem item, IReadOnlyList<LocalImageInfo> images)
changed = true;
}

if (item is IHasScreenshots && UpdateMultiImages(item, images, ImageType.Screenshot))
{
changed = true;
}

return changed;
}

Expand Down
24 changes: 7 additions & 17 deletions tests/Jellyfin.Providers.Tests/Manager/ItemImageProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
Expand Down Expand Up @@ -43,7 +42,7 @@ public void ValidateImages_PhotoEmptyProviders_NoChange()
public void ValidateImages_EmptyItemEmptyProviders_NoChange()
{
var itemImageProvider = GetItemImageProvider(null, null);
var changed = itemImageProvider.ValidateImages(new MovieWithScreenshots(), Enumerable.Empty<ILocalImageProvider>(), null);
var changed = itemImageProvider.ValidateImages(new Video(), Enumerable.Empty<ILocalImageProvider>(), null);

Assert.False(changed);
}
Expand All @@ -55,8 +54,7 @@ public void ValidateImages_EmptyItemEmptyProviders_NoChange()
// minimal test cases that hit different handling
{ ImageType.Primary, 1 },
{ ImageType.Backdrop, 1 },
{ ImageType.Backdrop, 2 },
{ ImageType.Screenshot, 1 }
{ ImageType.Backdrop, 2 }
};

return theoryTypes;
Expand All @@ -69,7 +67,7 @@ public void ValidateImages_EmptyItemAndPopulatedProviders_AddsImages(ImageType i
// Has to exist for querying DateModified time on file, results stored but not checked so not populating
BaseItem.FileSystem = Mock.Of<IFileSystem>();

var item = new MovieWithScreenshots();
var item = new Video();
var imageProvider = GetImageProvider(imageType, imageCount, true);

var itemImageProvider = GetItemImageProvider(null, null);
Expand Down Expand Up @@ -109,7 +107,7 @@ public void ValidateImages_PopulatedItemWithBadPathsAndEmptyProviders_RemovesIma
public void MergeImages_EmptyItemNewImagesEmpty_NoChange()
{
var itemImageProvider = GetItemImageProvider(null, null);
var changed = itemImageProvider.MergeImages(new MovieWithScreenshots(), Array.Empty<LocalImageInfo>());
var changed = itemImageProvider.MergeImages(new Video(), Array.Empty<LocalImageInfo>());

Assert.False(changed);
}
Expand Down Expand Up @@ -270,7 +268,7 @@ public async void RefreshImages_EmptyItemPopulatedProviderDynamic_AddsImages(Ima
// Has to exist for querying DateModified time on file, results stored but not checked so not populating
BaseItem.FileSystem = Mock.Of<IFileSystem>();

var item = new MovieWithScreenshots();
var item = new Video();

var libraryOptions = GetLibraryOptions(item, imageType, imageCount);

Expand Down Expand Up @@ -312,11 +310,9 @@ public async void RefreshImages_EmptyItemPopulatedProviderDynamic_AddsImages(Ima
[InlineData(ImageType.Primary, 1, false)]
[InlineData(ImageType.Backdrop, 1, false)]
[InlineData(ImageType.Backdrop, 2, false)]
[InlineData(ImageType.Screenshot, 2, false)]
[InlineData(ImageType.Primary, 1, true)]
[InlineData(ImageType.Backdrop, 1, true)]
[InlineData(ImageType.Backdrop, 2, true)]
[InlineData(ImageType.Screenshot, 2, true)]
public async void RefreshImages_PopulatedItemPopulatedProviderRemote_UpdatesImagesIfForced(ImageType imageType, int imageCount, bool forceRefresh)
{
var item = GetItemWithImages(imageType, imageCount, false);
Expand Down Expand Up @@ -439,7 +435,7 @@ public async void RefreshImages_NonStubItemPopulatedProviderRemote_DownloadsIfNe
[MemberData(nameof(GetImageTypesWithCount))]
public async void RefreshImages_EmptyItemPopulatedProviderRemoteExtras_LimitsImages(ImageType imageType, int imageCount)
{
var item = new MovieWithScreenshots();
var item = new Video();

var libraryOptions = GetLibraryOptions(item, imageType, imageCount);

Expand Down Expand Up @@ -528,7 +524,7 @@ private static BaseItem GetItemWithImages(ImageType type, int count, bool validP
// Has to exist for querying DateModified time on file, results stored but not checked so not populating
BaseItem.FileSystem ??= Mock.Of<IFileSystem>();

var item = new MovieWithScreenshots();
var item = new Video();

var path = validPaths ? TestDataImagePath : "invalid path {0}";
for (int i = 0; i < count; i++)
Expand Down Expand Up @@ -599,11 +595,5 @@ private static LibraryOptions GetLibraryOptions(BaseItem item, ImageType type, i
}
};
}

// Create a class that implements IHasScreenshots for testing since no BaseItem class is also IHasScreenshots
private class MovieWithScreenshots : Movie, IHasScreenshots
{
// No contents
}
}
}