mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 07:10:34 +02:00
Merge pull request #648 from thogil/lock_images
Added Images to MetadataFields
This commit is contained in:
commit
632ff32e7e
|
@ -41,6 +41,18 @@ namespace MediaBrowser.Model.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The official rating
|
/// The official rating
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OfficialRating
|
OfficialRating,
|
||||||
|
/// <summary>
|
||||||
|
/// The images
|
||||||
|
/// </summary>
|
||||||
|
Images,
|
||||||
|
/// <summary>
|
||||||
|
/// The backdrops
|
||||||
|
/// </summary>
|
||||||
|
Backdrops,
|
||||||
|
/// <summary>
|
||||||
|
/// The screenshots
|
||||||
|
/// </summary>
|
||||||
|
Screenshots
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,9 @@ namespace MediaBrowser.Providers.Movies
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't refresh if we already have both poster and backdrop and we're not refreshing images
|
// Don't refresh if we already have both poster and backdrop and we're not refreshing images
|
||||||
if (item.HasImage(ImageType.Primary) && item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops)
|
if (item.HasImage(ImageType.Primary) &&
|
||||||
|
item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops &&
|
||||||
|
!item.LockedFields.Contains(MetadataFields.Images))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +169,6 @@ namespace MediaBrowser.Providers.Movies
|
||||||
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
|
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualMovieDbImageProvider.ProviderName).ConfigureAwait(false);
|
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualMovieDbImageProvider.ProviderName).ConfigureAwait(false);
|
||||||
|
|
||||||
await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||||
|
@ -190,7 +191,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// poster
|
// poster
|
||||||
if (eligiblePosters.Count > 0 && !item.HasImage(ImageType.Primary))
|
if (eligiblePosters.Count > 0 && !item.HasImage(ImageType.Primary) && !item.LockedFields.Contains(MetadataFields.Images))
|
||||||
{
|
{
|
||||||
var poster = eligiblePosters[0];
|
var poster = eligiblePosters[0];
|
||||||
|
|
||||||
|
@ -216,7 +217,10 @@ namespace MediaBrowser.Providers.Movies
|
||||||
var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops;
|
var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops;
|
||||||
|
|
||||||
// backdrops - only download if earlier providers didn't find any (fanart)
|
// backdrops - only download if earlier providers didn't find any (fanart)
|
||||||
if (eligibleBackdrops.Count > 0 && ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count < backdropLimit)
|
if (eligibleBackdrops.Count > 0 &&
|
||||||
|
ConfigurationManager.Configuration.DownloadMovieImages.Backdrops &&
|
||||||
|
item.BackdropImagePaths.Count < backdropLimit &&
|
||||||
|
!item.LockedFields.Contains(MetadataFields.Backdrops))
|
||||||
{
|
{
|
||||||
for (var i = 0; i < eligibleBackdrops.Count; i++)
|
for (var i = 0; i < eligibleBackdrops.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,7 +164,6 @@ namespace MediaBrowser.Providers.Movies
|
||||||
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
|
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualMovieDbPersonImageProvider.ProviderName).ConfigureAwait(false);
|
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualMovieDbPersonImageProvider.ProviderName).ConfigureAwait(false);
|
||||||
|
|
||||||
await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||||
|
@ -187,7 +186,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// poster
|
// poster
|
||||||
if (eligiblePosters.Count > 0 && !item.HasImage(ImageType.Primary))
|
if (eligiblePosters.Count > 0 && !item.HasImage(ImageType.Primary) && !item.LockedFields.Contains(MetadataFields.Images))
|
||||||
{
|
{
|
||||||
var poster = eligiblePosters[0];
|
var poster = eligiblePosters[0];
|
||||||
|
|
||||||
|
|
|
@ -154,9 +154,11 @@ namespace MediaBrowser.Providers.Music
|
||||||
/// <returns>Task{System.Boolean}.</returns>
|
/// <returns>Task{System.Boolean}.</returns>
|
||||||
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
|
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartAlbumProvider.ProviderName).ConfigureAwait(false);
|
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||||
|
{
|
||||||
await FetchFromXml(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartAlbumProvider.ProviderName).ConfigureAwait(false);
|
||||||
|
await FetchFromXml(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||||
|
|
||||||
|
|
|
@ -213,13 +213,12 @@ namespace MediaBrowser.Providers.Music
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art ||
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art ||
|
||||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops ||
|
ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops ||
|
||||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner ||
|
ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner ||
|
||||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo ||
|
ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo ||
|
||||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary)
|
ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary)
|
||||||
{
|
{
|
||||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartArtistProvider.ProviderName).ConfigureAwait(false);
|
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartArtistProvider.ProviderName).ConfigureAwait(false);
|
||||||
|
|
||||||
await FetchFromXml(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
await FetchFromXml(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,46 +267,52 @@ namespace MediaBrowser.Providers.Music
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task FetchFromXml(BaseItem item, List<RemoteImageInfo> images , CancellationToken cancellationToken)
|
private async Task FetchFromXml(BaseItem item, List<RemoteImageInfo> images , CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.HasImage(ImageType.Primary))
|
|
||||||
{
|
{
|
||||||
await SaveImage(item, images, ImageType.Primary, cancellationToken).ConfigureAwait(false);
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.HasImage(ImageType.Primary))
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.HasImage(ImageType.Logo))
|
|
||||||
{
|
|
||||||
await SaveImage(item, images, ImageType.Logo, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.HasImage(ImageType.Art))
|
|
||||||
{
|
|
||||||
await SaveImage(item, images, ImageType.Art, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.HasImage(ImageType.Banner))
|
|
||||||
{
|
|
||||||
await SaveImage(item, images, ImageType.Banner, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops;
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops &&
|
|
||||||
item.BackdropImagePaths.Count < backdropLimit)
|
|
||||||
{
|
|
||||||
foreach (var image in images.Where(i => i.Type == ImageType.Backdrop))
|
|
||||||
{
|
{
|
||||||
await _providerManager.SaveImage(item, image.Url, FanArtResourcePool, ImageType.Backdrop, null, cancellationToken)
|
await SaveImage(item, images, ImageType.Primary, cancellationToken).ConfigureAwait(false);
|
||||||
.ConfigureAwait(false);
|
}
|
||||||
|
|
||||||
if (item.BackdropImagePaths.Count >= backdropLimit) break;
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.HasImage(ImageType.Logo))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Logo, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.HasImage(ImageType.Art))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Art, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.HasImage(ImageType.Banner))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Banner, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!item.LockedFields.Contains(MetadataFields.Backdrops))
|
||||||
|
{
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops;
|
||||||
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops &&
|
||||||
|
item.BackdropImagePaths.Count < backdropLimit)
|
||||||
|
{
|
||||||
|
foreach (var image in images.Where(i => i.Type == ImageType.Backdrop))
|
||||||
|
{
|
||||||
|
await _providerManager.SaveImage(item, image.Url, FanArtResourcePool, ImageType.Backdrop, null, cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (item.BackdropImagePaths.Count >= backdropLimit) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
? ConfigurationManager.Configuration.DownloadMusicAlbumImages
|
? ConfigurationManager.Configuration.DownloadMusicAlbumImages
|
||||||
: ConfigurationManager.Configuration.DownloadMusicArtistImages;
|
: ConfigurationManager.Configuration.DownloadMusicArtistImages;
|
||||||
|
|
||||||
if (configSetting.Primary && !item.HasImage(ImageType.Primary))
|
if (configSetting.Primary && !item.HasImage(ImageType.Primary) && !item.LockedFields.Contains(MetadataFields.Images))
|
||||||
{
|
{
|
||||||
var image = images.FirstOrDefault(i => i.Type == ImageType.Primary);
|
var image = images.FirstOrDefault(i => i.Type == ImageType.Primary);
|
||||||
|
|
||||||
|
|
|
@ -101,11 +101,10 @@ namespace MediaBrowser.Providers.TV
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
var season = (Season)item;
|
var season = (Season) item;
|
||||||
|
|
||||||
// Process images
|
// Process images
|
||||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartSeasonImageProvider.ProviderName).ConfigureAwait(false);
|
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartSeasonImageProvider.ProviderName).ConfigureAwait(false);
|
||||||
|
|
||||||
await FetchImages(season, images.ToList(), cancellationToken).ConfigureAwait(false);
|
await FetchImages(season, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||||
|
@ -121,7 +120,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task FetchImages(Season season, List<RemoteImageInfo> images, CancellationToken cancellationToken)
|
private async Task FetchImages(Season season, List<RemoteImageInfo> images, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Thumb && !season.HasImage(ImageType.Thumb))
|
if (ConfigurationManager.Configuration.DownloadSeasonImages.Thumb && !season.HasImage(ImageType.Thumb) && !season.LockedFields.Contains(MetadataFields.Images))
|
||||||
{
|
{
|
||||||
await SaveImage(season, images, ImageType.Thumb, cancellationToken).ConfigureAwait(false);
|
await SaveImage(season, images, ImageType.Thumb, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,56 +196,61 @@ namespace MediaBrowser.Providers.TV
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task FetchFromXml(BaseItem item, List<RemoteImageInfo> images, CancellationToken cancellationToken)
|
private async Task FetchFromXml(BaseItem item, List<RemoteImageInfo> images, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Primary && !item.HasImage(ImageType.Primary))
|
|
||||||
{
|
{
|
||||||
await SaveImage(item, images, ImageType.Primary, cancellationToken).ConfigureAwait(false);
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Primary && !item.HasImage(ImageType.Primary))
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo))
|
|
||||||
{
|
|
||||||
await SaveImage(item, images, ImageType.Logo, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !item.HasImage(ImageType.Art))
|
|
||||||
{
|
|
||||||
await SaveImage(item, images, ImageType.Art, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !item.HasImage(ImageType.Thumb))
|
|
||||||
{
|
|
||||||
await SaveImage(item, images, ImageType.Thumb, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !item.HasImage(ImageType.Banner))
|
|
||||||
{
|
|
||||||
await SaveImage(item, images, ImageType.Banner, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops;
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops &&
|
|
||||||
item.BackdropImagePaths.Count < backdropLimit)
|
|
||||||
{
|
|
||||||
foreach (var image in images.Where(i => i.Type == ImageType.Backdrop))
|
|
||||||
{
|
{
|
||||||
await _providerManager.SaveImage(item, image.Url, FanArtResourcePool, ImageType.Backdrop, null, cancellationToken)
|
await SaveImage(item, images, ImageType.Primary, cancellationToken).ConfigureAwait(false);
|
||||||
.ConfigureAwait(false);
|
}
|
||||||
|
|
||||||
if (item.BackdropImagePaths.Count >= backdropLimit) break;
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Logo, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !item.HasImage(ImageType.Art))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Art, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !item.HasImage(ImageType.Thumb))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Thumb, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !item.HasImage(ImageType.Banner))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Banner, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!item.LockedFields.Contains(MetadataFields.Backdrops))
|
||||||
|
{
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops;
|
||||||
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops &&
|
||||||
|
item.BackdropImagePaths.Count < backdropLimit)
|
||||||
|
{
|
||||||
|
foreach (var image in images.Where(i => i.Type == ImageType.Backdrop))
|
||||||
|
{
|
||||||
|
await _providerManager.SaveImage(item, image.Url, FanArtResourcePool, ImageType.Backdrop, null, cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (item.BackdropImagePaths.Count >= backdropLimit) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveImage(BaseItem item, List<RemoteImageInfo> images, ImageType type, CancellationToken cancellationToken)
|
private async Task SaveImage(BaseItem item, List<RemoteImageInfo> images, ImageType type, CancellationToken cancellationToken)
|
||||||
|
|
|
@ -75,9 +75,10 @@ namespace MediaBrowser.Providers.TV
|
||||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DownloadImages(BaseItem item, List<RemoteImageInfo> images, CancellationToken cancellationToken)
|
private async Task DownloadImages(BaseItem item, List<RemoteImageInfo> images, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!item.HasImage(ImageType.Primary))
|
if (!item.HasImage(ImageType.Primary) && !item.LockedFields.Contains(MetadataFields.Images))
|
||||||
{
|
{
|
||||||
var image = images.FirstOrDefault(i => i.Type == ImageType.Primary);
|
var image = images.FirstOrDefault(i => i.Type == ImageType.Primary);
|
||||||
|
|
||||||
|
|
|
@ -159,17 +159,20 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
private async Task DownloadImages(BaseItem item, List<RemoteImageInfo> images, int backdropLimit, CancellationToken cancellationToken)
|
private async Task DownloadImages(BaseItem item, List<RemoteImageInfo> images, int backdropLimit, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!item.HasImage(ImageType.Primary))
|
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||||
{
|
{
|
||||||
await SaveImage(item, images, ImageType.Primary, cancellationToken).ConfigureAwait(false);
|
if (!item.HasImage(ImageType.Primary))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Primary, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && !item.HasImage(ImageType.Banner))
|
||||||
|
{
|
||||||
|
await SaveImage(item, images, ImageType.Banner, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && !item.HasImage(ImageType.Banner))
|
if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && item.BackdropImagePaths.Count < backdropLimit && !item.LockedFields.Contains(MetadataFields.Backdrops))
|
||||||
{
|
|
||||||
await SaveImage(item, images, ImageType.Banner, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && item.BackdropImagePaths.Count < backdropLimit)
|
|
||||||
{
|
{
|
||||||
foreach (var backdrop in images.Where(i => i.Type == ImageType.Backdrop))
|
foreach (var backdrop in images.Where(i => i.Type == ImageType.Backdrop))
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
}
|
}
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
return base.NeedsRefreshInternal(item, providerInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -167,29 +167,32 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
private async Task DownloadImages(BaseItem item, List<RemoteImageInfo> images, int backdropLimit, CancellationToken cancellationToken)
|
private async Task DownloadImages(BaseItem item, List<RemoteImageInfo> images, int backdropLimit, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!item.HasImage(ImageType.Primary))
|
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||||
{
|
{
|
||||||
var image = images.FirstOrDefault(i => i.Type == ImageType.Primary);
|
if (!item.HasImage(ImageType.Primary))
|
||||||
|
|
||||||
if (image != null)
|
|
||||||
{
|
{
|
||||||
await _providerManager.SaveImage(item, image.Url, TvdbSeriesProvider.Current.TvDbResourcePool, ImageType.Primary, null, cancellationToken)
|
var image = images.FirstOrDefault(i => i.Type == ImageType.Primary);
|
||||||
.ConfigureAwait(false);
|
|
||||||
|
if (image != null)
|
||||||
|
{
|
||||||
|
await _providerManager.SaveImage(item, image.Url, TvdbSeriesProvider.Current.TvDbResourcePool, ImageType.Primary, null, cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !item.HasImage(ImageType.Banner))
|
||||||
|
{
|
||||||
|
var image = images.FirstOrDefault(i => i.Type == ImageType.Banner);
|
||||||
|
|
||||||
|
if (image != null)
|
||||||
|
{
|
||||||
|
await _providerManager.SaveImage(item, image.Url, TvdbSeriesProvider.Current.TvDbResourcePool, ImageType.Banner, null, cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !item.HasImage(ImageType.Banner))
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops && item.BackdropImagePaths.Count < backdropLimit && !item.LockedFields.Contains(MetadataFields.Backdrops))
|
||||||
{
|
|
||||||
var image = images.FirstOrDefault(i => i.Type == ImageType.Banner);
|
|
||||||
|
|
||||||
if (image != null)
|
|
||||||
{
|
|
||||||
await _providerManager.SaveImage(item, image.Url, TvdbSeriesProvider.Current.TvDbResourcePool, ImageType.Banner, null, cancellationToken)
|
|
||||||
.ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops && item.BackdropImagePaths.Count < backdropLimit)
|
|
||||||
{
|
{
|
||||||
foreach (var backdrop in images.Where(i => i.Type == ImageType.Backdrop &&
|
foreach (var backdrop in images.Where(i => i.Type == ImageType.Backdrop &&
|
||||||
(!i.Width.HasValue ||
|
(!i.Width.HasValue ||
|
||||||
|
|
Loading…
Reference in a new issue