fixes #627 - Populate album release date with id3 info, when availalbe
This commit is contained in:
parent
340c80bcec
commit
ad3e4dee0e
|
@ -69,6 +69,24 @@ namespace MediaBrowser.Providers.Music
|
|||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
var date = songs.Select(i => i.PremiereDate)
|
||||
.FirstOrDefault(i => i.HasValue);
|
||||
|
||||
if (date.HasValue)
|
||||
{
|
||||
album.PremiereDate = date.Value;
|
||||
album.ProductionYear = date.Value.Year;
|
||||
}
|
||||
else
|
||||
{
|
||||
var year = songs.Select(i => i.ProductionYear ?? 1800).FirstOrDefault(i => i != 1800);
|
||||
|
||||
if (year != 1800)
|
||||
{
|
||||
album.ProductionYear = year;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't save to the db
|
||||
return FalseTaskResult;
|
||||
}
|
||||
|
|
|
@ -107,23 +107,6 @@ 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);
|
||||
|
||||
if (year != 1800)
|
||||
{
|
||||
album.ProductionYear = year;
|
||||
}
|
||||
}
|
||||
|
||||
if (!item.LockedFields.Contains(MetadataFields.Studios))
|
||||
{
|
||||
album.Studios = songs.SelectMany(i => i.Studios)
|
||||
|
|
|
@ -103,15 +103,19 @@ namespace MediaBrowser.Providers.Music
|
|||
item.Overview = overview;
|
||||
}
|
||||
|
||||
DateTime release;
|
||||
|
||||
if (DateTime.TryParse(data.releasedate, out release))
|
||||
// Only grab the date here if the album doesn't already have one, since id3 tags are preferred
|
||||
if (!item.PremiereDate.HasValue)
|
||||
{
|
||||
// Lastfm sends back null as sometimes 1901, other times 0
|
||||
if (release.Year > 1901)
|
||||
DateTime release;
|
||||
|
||||
if (DateTime.TryParse(data.releasedate, out release))
|
||||
{
|
||||
item.PremiereDate = release;
|
||||
item.ProductionYear = release.Year;
|
||||
// Lastfm sends back null as sometimes 1901, other times 0
|
||||
if (release.Year > 1901)
|
||||
{
|
||||
item.PremiereDate = release;
|
||||
item.ProductionYear = release.Year;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user