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

This commit is contained in:
Luke Pulverenti 2013-11-09 13:44:38 -05:00
parent b043336977
commit 391675a345
3 changed files with 6 additions and 151 deletions

View File

@ -288,9 +288,6 @@ namespace MediaBrowser.Api.DefaultTheme
var view = new TvView();
SetFavoriteGenres(view, series, user);
SetFavoriteStudios(view, series, user);
var fields = new List<ItemFields>();
var seriesWithBestBackdrops = FilterItemsForBackdropDisplay(seriesWithBackdrops).ToList();
@ -401,146 +398,6 @@ namespace MediaBrowser.Api.DefaultTheme
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)
{
var user = _userManager.GetUserById(request.UserId);
@ -557,9 +414,6 @@ namespace MediaBrowser.Api.DefaultTheme
var movies = items.OfType<Movie>()
.ToList();
SetFavoriteGenres(view, movies, user);
SetFavoriteStudios(view, movies, user);
var trailers = items.OfType<Trailer>()
.ToList();

View File

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

View File

@ -383,6 +383,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The album image tag.</value>
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>
/// Gets or sets the album artist.
/// </summary>