mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
Merge pull request #6769 from Bond-009/hasscreenshots
This commit is contained in:
commit
ad7ed95b98
4 changed files with 7 additions and 47 deletions
|
@ -1,9 +0,0 @@
|
|||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// The item has screenshots.
|
||||
/// </summary>
|
||||
public interface IHasScreenshots
|
||||
{
|
||||
}
|
||||
}
|
|
@ -256,11 +256,6 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
{
|
||||
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)
|
||||
|
@ -363,11 +358,6 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
}));
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -343,12 +343,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -438,11 +432,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
changed = true;
|
||||
}
|
||||
|
||||
if (item is IHasScreenshots && UpdateMultiImages(item, images, ImageType.Screenshot))
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ using System.Text.RegularExpressions;
|
|||
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;
|
||||
|
@ -43,7 +42,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
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);
|
||||
}
|
||||
|
@ -55,8 +54,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
// minimal test cases that hit different handling
|
||||
{ ImageType.Primary, 1 },
|
||||
{ ImageType.Backdrop, 1 },
|
||||
{ ImageType.Backdrop, 2 },
|
||||
{ ImageType.Screenshot, 1 }
|
||||
{ ImageType.Backdrop, 2 }
|
||||
};
|
||||
|
||||
return theoryTypes;
|
||||
|
@ -69,7 +67,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
// 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);
|
||||
|
@ -109,7 +107,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
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);
|
||||
}
|
||||
|
@ -270,7 +268,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
// 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);
|
||||
|
||||
|
@ -312,11 +310,9 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
[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);
|
||||
|
@ -439,7 +435,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
[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);
|
||||
|
||||
|
@ -528,7 +524,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
// 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++)
|
||||
|
@ -599,11 +595,5 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Create a class that implements IHasScreenshots for testing since no BaseItem class is also IHasScreenshots
|
||||
private class MovieWithScreenshots : Movie, IHasScreenshots
|
||||
{
|
||||
// No contents
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue