Removed unused properties from BaseItem.

This commit is contained in:
Luke Pulverenti
2013-12-05 11:50:21 -05:00
parent 9e84a712ae
commit 55a776427b
59 changed files with 766 additions and 556 deletions

View File

@@ -392,7 +392,13 @@ namespace MediaBrowser.Server.Implementations.Dto
/// <returns>List{Guid}.</returns>
private List<Guid> GetScreenshotImageTags(BaseItem item)
{
return item.ScreenshotImagePaths
var hasScreenshots = item as IHasScreenshots;
if (hasScreenshots == null)
{
return new List<Guid>();
}
return hasScreenshots.ScreenshotImagePaths
.Select(p => GetImageCacheTag(item, ImageType.Screenshot, p))
.Where(i => i.HasValue)
.Select(i => i.Value)
@@ -746,12 +752,21 @@ namespace MediaBrowser.Server.Implementations.Dto
if (fields.Contains(ItemFields.Tags))
{
dto.Tags = item.Tags;
var hasTags = item as IHasTags;
if (hasTags != null)
{
dto.Tags = hasTags.Tags;
}
if (dto.Tags == null)
{
dto.Tags = new List<string>();
}
}
if (fields.Contains(ItemFields.ProductionLocations))
{
dto.ProductionLocations = item.ProductionLocations;
SetProductionLocations(item, dto);
}
var hasAspectRatio = item as IHasAspectRatio;
@@ -789,10 +804,15 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.Id = GetDtoId(item);
dto.IndexNumber = item.IndexNumber;
dto.IsFolder = item.IsFolder;
dto.Language = item.Language;
dto.MediaType = item.MediaType;
dto.LocationType = item.LocationType;
var hasLanguage = item as IHasLanguage;
if (hasLanguage != null)
{
dto.Language = hasLanguage.Language;
}
var hasCriticRating = item as IHasCriticRating;
if (hasCriticRating != null)
{
@@ -924,7 +944,16 @@ namespace MediaBrowser.Server.Implementations.Dto
if (fields.Contains(ItemFields.Taglines))
{
dto.Taglines = item.Taglines;
var hasTagline = item as IHasTaglines;
if (hasTagline != null)
{
dto.Taglines = hasTagline.Taglines;
}
if (dto.Taglines == null)
{
dto.Taglines = new List<string>();
}
}
dto.Type = item.GetClientTypeName();
@@ -1122,6 +1151,31 @@ namespace MediaBrowser.Server.Implementations.Dto
}
}
private void SetProductionLocations(BaseItem item, BaseItemDto dto)
{
var hasProductionLocations = item as IHasProductionLocations;
if (hasProductionLocations != null)
{
dto.ProductionLocations = hasProductionLocations.ProductionLocations;
}
var person = item as Person;
if (person != null)
{
dto.ProductionLocations = new List<string>();
if (!string.IsNullOrEmpty(person.PlaceOfBirth))
{
dto.ProductionLocations.Add(person.PlaceOfBirth);
}
}
if (dto.ProductionLocations == null)
{
dto.ProductionLocations = new List<string>();
}
}
/// <summary>
/// Since it can be slow to make all of these calculations independently, this method will provide a way to do them all at once
/// </summary>