get album premiere date from songs

This commit is contained in:
Luke Pulverenti 2013-10-17 11:35:28 -04:00
parent 20014dea8c
commit 6d68612e47

View File

@ -107,12 +107,22 @@ namespace MediaBrowser.Providers.Music
} }
} }
var date = songs.Select(i => i.PremiereDate).FirstOrDefault(i => i.HasValue);
if (date != null)
{
album.PremiereDate = date.Value;
album.ProductionYear = date.Value.Year;
}
else
{
var year = songs.Select(i => i.ProductionYear ?? 1800).FirstOrDefault(i => i != 1800); var year = songs.Select(i => i.ProductionYear ?? 1800).FirstOrDefault(i => i != 1800);
if (year != 1800) if (year != 1800)
{ {
album.ProductionYear = year; album.ProductionYear = year;
} }
}
if (!item.LockedFields.Contains(MetadataFields.Studios)) if (!item.LockedFields.Contains(MetadataFields.Studios))
{ {