Merge pull request #12055 from Shadowghost/fix-season-backdrops
Fix season backdrops
This commit is contained in:
commit
2266a00337
|
@ -427,7 +427,9 @@ namespace MediaBrowser.Providers.Manager
|
||||||
|
|
||||||
if (type == ImageType.Backdrop && saveLocally)
|
if (type == ImageType.Backdrop && saveLocally)
|
||||||
{
|
{
|
||||||
if (season is not null && season.IndexNumber.HasValue)
|
if (season is not null
|
||||||
|
&& season.IndexNumber.HasValue
|
||||||
|
&& (imageIndex is null || imageIndex == 0))
|
||||||
{
|
{
|
||||||
var seriesFolder = season.SeriesPath;
|
var seriesFolder = season.SeriesPath;
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// only delete existing multi-images if new ones were added
|
// Only delete existing multi-images if new ones were added
|
||||||
if (oldBackdropImages.Length > 0 && oldBackdropImages.Length < item.GetImages(ImageType.Backdrop).Count())
|
if (oldBackdropImages.Length > 0 && oldBackdropImages.Length < item.GetImages(ImageType.Backdrop).Count())
|
||||||
{
|
{
|
||||||
PruneImages(item, oldBackdropImages);
|
PruneImages(item, oldBackdropImages);
|
||||||
|
@ -422,14 +422,11 @@ namespace MediaBrowser.Providers.Manager
|
||||||
{
|
{
|
||||||
var changed = item.ValidateImages();
|
var changed = item.ValidateImages();
|
||||||
var foundImageTypes = new List<ImageType>();
|
var foundImageTypes = new List<ImageType>();
|
||||||
|
|
||||||
for (var i = 0; i < _singularImages.Length; i++)
|
for (var i = 0; i < _singularImages.Length; i++)
|
||||||
{
|
{
|
||||||
var type = _singularImages[i];
|
var type = _singularImages[i];
|
||||||
var image = GetFirstLocalImageInfoByType(images, type);
|
var image = GetFirstLocalImageInfoByType(images, type);
|
||||||
|
if (image is not null)
|
||||||
// Only use local images if we are not replacing and saving
|
|
||||||
if (image is not null && !(item.IsSaveLocalMetadataEnabled() && refreshOptions.ReplaceAllImages))
|
|
||||||
{
|
{
|
||||||
var currentImage = item.GetImageInfo(type, 0);
|
var currentImage = item.GetImageInfo(type, 0);
|
||||||
// if image file is stored with media, don't replace that later
|
// if image file is stored with media, don't replace that later
|
||||||
|
|
|
@ -100,12 +100,19 @@ namespace MediaBrowser.Providers.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start by validating images
|
|
||||||
var localImagesFailed = false;
|
var localImagesFailed = false;
|
||||||
var allImageProviders = ProviderManager.GetImageProviders(item, refreshOptions).ToList();
|
var allImageProviders = ProviderManager.GetImageProviders(item, refreshOptions).ToList();
|
||||||
|
|
||||||
|
// Only validate already registered images if we are replacing and saving locally
|
||||||
|
if (item.IsSaveLocalMetadataEnabled() && refreshOptions.ReplaceAllImages)
|
||||||
|
{
|
||||||
|
item.ValidateImages();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Run full image validation and register new local images
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Always validate images and check for new locally stored ones.
|
|
||||||
if (ImageProvider.ValidateImages(item, allImageProviders.OfType<ILocalImageProvider>(), refreshOptions))
|
if (ImageProvider.ValidateImages(item, allImageProviders.OfType<ILocalImageProvider>(), refreshOptions))
|
||||||
{
|
{
|
||||||
updateType |= ItemUpdateType.ImageUpdate;
|
updateType |= ItemUpdateType.ImageUpdate;
|
||||||
|
@ -116,6 +123,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
localImagesFailed = true;
|
localImagesFailed = true;
|
||||||
Logger.LogError(ex, "Error validating images for {Item}", item.Path ?? item.Name ?? "Unknown name");
|
Logger.LogError(ex, "Error validating images for {Item}", item.Path ?? item.Name ?? "Unknown name");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var metadataResult = new MetadataResult<TItemType>
|
var metadataResult = new MetadataResult<TItemType>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user