Added Images to MetadataFields
This commit is contained in:
parent
0eea77b837
commit
08b7f88b22
|
@ -41,6 +41,10 @@ namespace MediaBrowser.Model.Entities
|
|||
/// <summary>
|
||||
/// The official rating
|
||||
/// </summary>
|
||||
OfficialRating
|
||||
OfficialRating,
|
||||
/// <summary>
|
||||
/// The images
|
||||
/// </summary>
|
||||
Images
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
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;
|
||||
}
|
||||
|
@ -166,9 +168,11 @@ namespace MediaBrowser.Providers.Movies
|
|||
/// <returns>Task{System.Boolean}.</returns>
|
||||
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);
|
||||
|
||||
await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||
{
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualMovieDbImageProvider.ProviderName).ConfigureAwait(false);
|
||||
await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
return true;
|
||||
|
|
|
@ -163,9 +163,11 @@ namespace MediaBrowser.Providers.Movies
|
|||
/// <returns>Task{System.Boolean}.</returns>
|
||||
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);
|
||||
|
||||
await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||
{
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualMovieDbPersonImageProvider.ProviderName).ConfigureAwait(false);
|
||||
await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
return true;
|
||||
|
|
|
@ -154,9 +154,11 @@ namespace MediaBrowser.Providers.Music
|
|||
/// <returns>Task{System.Boolean}.</returns>
|
||||
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);
|
||||
|
||||
await FetchFromXml(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||
{
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartAlbumProvider.ProviderName).ConfigureAwait(false);
|
||||
await FetchFromXml(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
|
||||
|
|
|
@ -212,14 +212,14 @@ namespace MediaBrowser.Providers.Music
|
|||
await DownloadArtistXml(artistDataPath, musicBrainzId, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art ||
|
||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops ||
|
||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner ||
|
||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo ||
|
||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary)
|
||||
if (!item.LockedFields.Contains(MetadataFields.Images) &&
|
||||
(ConfigurationManager.Configuration.DownloadMusicArtistImages.Art ||
|
||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops ||
|
||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner ||
|
||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo ||
|
||||
ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary))
|
||||
{
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartArtistProvider.ProviderName).ConfigureAwait(false);
|
||||
|
||||
await FetchFromXml(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace MediaBrowser.Providers.Music
|
|||
? ConfigurationManager.Configuration.DownloadMusicAlbumImages
|
||||
: 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);
|
||||
|
||||
|
|
|
@ -103,10 +103,12 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
var season = (Season)item;
|
||||
|
||||
// Process images
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartSeasonImageProvider.ProviderName).ConfigureAwait(false);
|
||||
|
||||
await FetchImages(season, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||
{
|
||||
// Process images
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualFanartSeasonImageProvider.ProviderName).ConfigureAwait(false);
|
||||
await FetchImages(season, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
return true;
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
var seriesId = item.GetProviderId(MetadataProviders.Tvdb);
|
||||
|
||||
if (!string.IsNullOrEmpty(seriesId))
|
||||
if (!string.IsNullOrEmpty(seriesId) && !item.LockedFields.Contains(MetadataFields.Images))
|
||||
{
|
||||
var xmlPath = GetFanartXmlPath(seriesId);
|
||||
|
||||
|
|
|
@ -75,9 +75,10 @@ namespace MediaBrowser.Providers.TV
|
|||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -147,11 +147,14 @@ namespace MediaBrowser.Providers.TV
|
|||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualTvdbSeasonImageProvider.ProviderName).ConfigureAwait(false);
|
||||
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||
{
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualTvdbSeasonImageProvider.ProviderName).ConfigureAwait(false);
|
||||
|
||||
const int backdropLimit = 1;
|
||||
const int backdropLimit = 1;
|
||||
|
||||
await DownloadImages(item, images.ToList(), backdropLimit, cancellationToken).ConfigureAwait(false);
|
||||
await DownloadImages(item, images.ToList(), backdropLimit, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
return true;
|
||||
|
|
|
@ -155,11 +155,14 @@ namespace MediaBrowser.Providers.TV
|
|||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualTvdbSeriesImageProvider.ProviderName).ConfigureAwait(false);
|
||||
if (!item.LockedFields.Contains(MetadataFields.Images))
|
||||
{
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualTvdbSeriesImageProvider.ProviderName).ConfigureAwait(false);
|
||||
|
||||
const int backdropLimit = 1;
|
||||
const int backdropLimit = 1;
|
||||
|
||||
await DownloadImages(item, images.ToList(), backdropLimit, cancellationToken).ConfigureAwait(false);
|
||||
await DownloadImages(item, images.ToList(), backdropLimit, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user