make web client images more efficient by using max height instead of height

pull/702/head
Luke Pulverenti 11 years ago
parent b043336977
commit 391675a345

@ -288,9 +288,6 @@ namespace MediaBrowser.Api.DefaultTheme
var view = new TvView(); var view = new TvView();
SetFavoriteGenres(view, series, user);
SetFavoriteStudios(view, series, user);
var fields = new List<ItemFields>(); var fields = new List<ItemFields>();
var seriesWithBestBackdrops = FilterItemsForBackdropDisplay(seriesWithBackdrops).ToList(); var seriesWithBestBackdrops = FilterItemsForBackdropDisplay(seriesWithBackdrops).ToList();
@ -401,146 +398,6 @@ namespace MediaBrowser.Api.DefaultTheme
return ToOptimizedResult(view); return ToOptimizedResult(view);
} }
private void SetFavoriteGenres(TvView view, IEnumerable<BaseItem> inputItems, User user)
{
var all = inputItems.SelectMany(i => i.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase);
view.FavoriteGenres = all.Select(i =>
{
try
{
var itemByName = _libraryManager.GetGenre(i);
var counts = itemByName.GetItemByNameCounts(user);
var count = counts == null ? 0 : counts.SeriesCount;
if (count > 0 && _userDataManager.GetUserData(user.Id, itemByName.GetUserDataKey()).IsFavorite)
{
return new ItemByNameInfo
{
Name = itemByName.Name,
ItemCount = count
};
}
}
catch (Exception ex)
{
_logger.ErrorException("Error getting genre {0}", ex, i);
}
return null;
}).Where(i => i != null).ToList();
}
private void SetFavoriteStudios(TvView view, IEnumerable<BaseItem> inputItems, User user)
{
var all = inputItems.SelectMany(i => i.Studios)
.Distinct(StringComparer.OrdinalIgnoreCase);
view.FavoriteStudios = all.Select(i =>
{
try
{
var itemByName = _libraryManager.GetStudio(i);
var counts = itemByName.GetItemByNameCounts(user);
var count = counts == null ? 0 : counts.SeriesCount;
if (count > 0 && _userDataManager.GetUserData(user.Id, itemByName.GetUserDataKey()).IsFavorite)
{
return new ItemByNameInfo
{
Name = itemByName.Name,
ItemCount = count
};
}
}
catch (Exception ex)
{
_logger.ErrorException("Error getting studio {0}", ex, i);
}
return null;
}).Where(i => i != null).ToList();
}
private void SetFavoriteGenres(MoviesView view, IEnumerable<BaseItem> inputItems, User user)
{
var all = inputItems.SelectMany(i => i.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase);
view.FavoriteGenres = all.Select(i =>
{
try
{
var itemByName = _libraryManager.GetGenre(i);
var counts = itemByName.GetItemByNameCounts(user);
var count = counts == null ? 0 : counts.MovieCount;
if (count > 0 && _userDataManager.GetUserData(user.Id, itemByName.GetUserDataKey()).IsFavorite)
{
return new ItemByNameInfo
{
Name = itemByName.Name,
ItemCount = count
};
}
}
catch (Exception ex)
{
_logger.ErrorException("Error getting genre {0}", ex, i);
}
return null;
}).Where(i => i != null).ToList();
}
private void SetFavoriteStudios(MoviesView view, IEnumerable<BaseItem> inputItems, User user)
{
var all = inputItems.SelectMany(i => i.Studios)
.Distinct(StringComparer.OrdinalIgnoreCase);
view.FavoriteStudios = all.Select(i =>
{
try
{
var itemByName = _libraryManager.GetStudio(i);
var counts = itemByName.GetItemByNameCounts(user);
var count = counts == null ? 0 : counts.MovieCount;
if (count > 0 && _userDataManager.GetUserData(user.Id, itemByName.GetUserDataKey()).IsFavorite)
{
return new ItemByNameInfo
{
Name = itemByName.Name,
ItemCount = count
};
}
}
catch (Exception ex)
{
_logger.ErrorException("Error getting studio {0}", ex, i);
}
return null;
}).Where(i => i != null).ToList();
}
public object Get(GetMovieView request) public object Get(GetMovieView request)
{ {
var user = _userManager.GetUserById(request.UserId); var user = _userManager.GetUserById(request.UserId);
@ -557,9 +414,6 @@ namespace MediaBrowser.Api.DefaultTheme
var movies = items.OfType<Movie>() var movies = items.OfType<Movie>()
.ToList(); .ToList();
SetFavoriteGenres(view, movies, user);
SetFavoriteStudios(view, movies, user);
var trailers = items.OfType<Trailer>() var trailers = items.OfType<Trailer>()
.ToList(); .ToList();

@ -34,9 +34,6 @@ namespace MediaBrowser.Api.DefaultTheme
public List<BaseItemDto> LatestTrailers { get; set; } public List<BaseItemDto> LatestTrailers { get; set; }
public List<BaseItemDto> LatestMovies { get; set; } public List<BaseItemDto> LatestMovies { get; set; }
public List<ItemByNameInfo> FavoriteGenres { get; set; }
public List<ItemByNameInfo> FavoriteStudios { get; set; }
} }
public class TvView : BaseView public class TvView : BaseView
@ -47,8 +44,6 @@ namespace MediaBrowser.Api.DefaultTheme
public List<ItemStub> RomanceItems { get; set; } public List<ItemStub> RomanceItems { get; set; }
public List<ItemStub> ComedyItems { get; set; } public List<ItemStub> ComedyItems { get; set; }
public List<ItemByNameInfo> FavoriteGenres { get; set; }
public List<ItemByNameInfo> FavoriteStudios { get; set; }
public List<string> SeriesIdsInProgress { get; set; } public List<string> SeriesIdsInProgress { get; set; }
public List<BaseItemDto> LatestEpisodes { get; set; } public List<BaseItemDto> LatestEpisodes { get; set; }

@ -383,6 +383,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The album image tag.</value> /// <value>The album image tag.</value>
public Guid? AlbumPrimaryImageTag { get; set; } public Guid? AlbumPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the series primary image tag.
/// </summary>
/// <value>The series primary image tag.</value>
public Guid? SeriesPrimaryImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the album artist. /// Gets or sets the album artist.
/// </summary> /// </summary>

Loading…
Cancel
Save