fix merge conflict

This commit is contained in:
Luke Pulverenti 2016-12-18 00:47:12 -05:00
parent e7cebb91a7
commit d7ad1331f1

View File

@ -566,18 +566,35 @@ namespace MediaBrowser.Controller.Entities
private async Task<QueryResult<BaseItem>> GetMovieGenres(Folder parent, User user, InternalItemsQuery query) private async Task<QueryResult<BaseItem>> GetMovieGenres(Folder parent, User user, InternalItemsQuery query)
{ {
var result = _libraryManager.GetGenres(new InternalItemsQuery(user) var tasks = parent.QueryRecursive(new InternalItemsQuery(user)
{ {
AncestorIds = new[] { parent.Id.ToString("N") }, IncludeItemTypes = new[] { typeof(Movie).Name },
StartIndex = query.StartIndex, Recursive = true,
Limit = query.Limit EnableTotalRecordCount = false
});
return new QueryResult<BaseItem> }).Items
{ .SelectMany(i => i.Genres)
TotalRecordCount = result.TotalRecordCount, .DistinctNames()
Items = result.Items.Select(i => i.Item1).ToArray() .Select(i =>
}; {
try
{
return _libraryManager.GetGenre(i);
}
catch
{
// Full exception logged at lower levels
_logger.Error("Error getting genre");
return null;
}
})
.Where(i => i != null)
.Select(i => GetUserView(i.Name, SpecialFolder.MovieGenre, i.SortName, parent));
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
return GetResult(genres, parent, query);
} }
private async Task<QueryResult<BaseItem>> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query) private async Task<QueryResult<BaseItem>> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
@ -692,18 +709,35 @@ namespace MediaBrowser.Controller.Entities
private async Task<QueryResult<BaseItem>> GetTvGenres(Folder parent, User user, InternalItemsQuery query) private async Task<QueryResult<BaseItem>> GetTvGenres(Folder parent, User user, InternalItemsQuery query)
{ {
var result = _libraryManager.GetGenres(new InternalItemsQuery(user) var tasks = parent.QueryRecursive(new InternalItemsQuery(user)
{ {
AncestorIds = new[] { parent.Id.ToString("N") }, IncludeItemTypes = new[] { typeof(Series).Name },
StartIndex = query.StartIndex, Recursive = true,
Limit = query.Limit EnableTotalRecordCount = false
});
return new QueryResult<BaseItem> }).Items
{ .SelectMany(i => i.Genres)
TotalRecordCount = result.TotalRecordCount, .DistinctNames()
Items = result.Items.Select(i => i.Item1).ToArray() .Select(i =>
}; {
try
{
return _libraryManager.GetGenre(i);
}
catch
{
// Full exception logged at lower levels
_logger.Error("Error getting genre");
return null;
}
})
.Where(i => i != null)
.Select(i => GetUserView(i.Name, SpecialFolder.TvGenre, i.SortName, parent));
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
return GetResult(genres, parent, query);
} }
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)