try to avoid album year of zero

pull/702/head
Luke Pulverenti 11 years ago
parent 09f44715bb
commit 04f165283b

@ -68,7 +68,7 @@ namespace MediaBrowser.Controller.Drawing
/// <param name="imageEnhancers">The image enhancers.</param>
/// <returns>Guid.</returns>
Guid GetImageCacheTag(BaseItem item, ImageType imageType, string originalImagePath, DateTime dateModified,
IEnumerable<IImageEnhancer> imageEnhancers);
List<IImageEnhancer> imageEnhancers);
/// <summary>
/// Processes the image.

@ -25,8 +25,13 @@ namespace MediaBrowser.Providers.Music
}
}
artist.PremiereDate = yearFormed > 0 ? new DateTime(yearFormed, 1, 1, 0, 0, 0, DateTimeKind.Utc) : (DateTime?)null;
if (yearFormed > 0)
{
artist.PremiereDate = new DateTime(yearFormed, 1, 1, 0, 0, 0, DateTimeKind.Utc);
artist.ProductionYear = yearFormed;
}
if (data.tags != null && !artist.LockedFields.Contains(MetadataFields.Tags))
{
AddTags(artist, data.tags);
@ -102,11 +107,15 @@ namespace MediaBrowser.Providers.Music
DateTime release;
if (DateTime.TryParse(data.releasedate, out release) && release.Year != 1901)
if (DateTime.TryParse(data.releasedate, out release))
{
// Lastfm sends back null as sometimes 1901, other times 0
if (release.Year > 1901)
{
item.PremiereDate = release;
item.ProductionYear = release.Year;
}
}
if (data.toptags != null && !item.LockedFields.Contains(MetadataFields.Tags))
{

@ -589,7 +589,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
var supportedEnhancers = GetSupportedEnhancers(item, imageType);
return GetImageCacheTag(item, imageType, imagePath, dateModified, supportedEnhancers);
return GetImageCacheTag(item, imageType, imagePath, dateModified, supportedEnhancers.ToList());
}
/// <summary>
@ -602,7 +602,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
/// <param name="imageEnhancers">The image enhancers.</param>
/// <returns>Guid.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
public Guid GetImageCacheTag(BaseItem item, ImageType imageType, string originalImagePath, DateTime dateModified, IEnumerable<IImageEnhancer> imageEnhancers)
public Guid GetImageCacheTag(BaseItem item, ImageType imageType, string originalImagePath, DateTime dateModified, List<IImageEnhancer> imageEnhancers)
{
if (item == null)
{
@ -619,6 +619,12 @@ namespace MediaBrowser.Server.Implementations.Drawing
throw new ArgumentNullException("originalImagePath");
}
// Optimization
if (imageEnhancers.Count == 0)
{
return (originalImagePath + dateModified.Ticks).GetMD5();
}
// Cache name is created with supported enhancers combined with the last config change so we pick up new config changes
var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList();
cacheKeys.Add(originalImagePath + dateModified.Ticks);
@ -879,7 +885,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
{
try
{
return i.Supports(item as BaseItem, imageType);
return i.Supports(item, imageType);
}
catch (Exception ex)
{
@ -888,7 +894,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
return false;
}
}).ToList();
});
}
public void Dispose()

Loading…
Cancel
Save