updated mbt api

This commit is contained in:
Luke Pulverenti 2013-11-05 13:20:24 -05:00
parent 3b63b7fa61
commit 1ae58d90ea
3 changed files with 28 additions and 3 deletions

View File

@ -62,6 +62,12 @@ namespace MediaBrowser.Api.DefaultTheme
[ApiMember(Name = "RomanceGenre", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string RomanceGenre { get; set; }
[ApiMember(Name = "LatestMoviesLimit", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int LatestMoviesLimit { get; set; }
[ApiMember(Name = "LatestTrailersLimit", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int LatestTrailersLimit { get; set; }
}
[Route("/MBT/DefaultTheme/Favorites", "GET")]
@ -481,6 +487,9 @@ namespace MediaBrowser.Api.DefaultTheme
var movies = items.OfType<Movie>()
.ToList();
var trailers = items.OfType<Trailer>()
.ToList();
var hdMovies = movies.Where(i => i.IsHD).ToList();
var familyGenres = request.FamilyGenre.Split(',').ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
@ -515,8 +524,7 @@ namespace MediaBrowser.Api.DefaultTheme
.Take(1)
.ToList();
view.TrailerItems = items
.OfType<Trailer>()
view.TrailerItems = trailers
.Where(i => !string.IsNullOrEmpty(i.PrimaryImagePath))
.OrderBy(i => Guid.NewGuid())
.Select(i => GetItemStub(i, ImageType.Primary))
@ -623,6 +631,20 @@ namespace MediaBrowser.Api.DefaultTheme
.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
.ToList();
view.LatestMovies = movies
.OrderByDescending(i => i.DateCreated)
.Where(i => !_userDataManager.GetUserData(user.Id, i.GetUserDataKey()).Played)
.Take(request.LatestMoviesLimit)
.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
.ToList();
view.LatestTrailers = trailers
.OrderByDescending(i => i.DateCreated)
.Where(i => !_userDataManager.GetUserData(user.Id, i.GetUserDataKey()).Played)
.Take(request.LatestTrailersLimit)
.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
.ToList();
return ToOptimizedResult(view);
}

View File

@ -31,6 +31,9 @@ namespace MediaBrowser.Api.DefaultTheme
public double FamilyMoviePercentage { get; set; }
public double HDMoviePercentage { get; set; }
public List<BaseItemDto> LatestTrailers { get; set; }
public List<BaseItemDto> LatestMovies { get; set; }
}
public class TvView : BaseView

View File

@ -80,7 +80,7 @@ namespace MediaBrowser.Providers.Movies
{
get
{
return ItemUpdateType.ImageUpdate | ItemUpdateType.MetadataDownload;
return ItemUpdateType.MetadataDownload;
}
}