private ReportStatResult GetResultGenres(ReportStatResult result, BaseItem[] items, int topItem = 5) { this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderGenres"), topItem, items.SelectMany(x => x.Genres) .GroupBy(x => x) .OrderByDescending(x => x.Count()) .Take(topItem) .Select(x => new ReportStatItem { Name = x.Key, Value = x.Count().ToString(), Id = GetGenreID(x.Key) })); return result; }
private ReportStatResult GetResultPersons(ReportStatResult result, BaseItem[] items, int topItem = 5) { List<string> t = new List<string> { PersonType.Actor, PersonType.Composer, PersonType.Director, PersonType.GuestStar, PersonType.Producer, PersonType.Writer, "Artist", "AlbumArtist" }; foreach (var item in t) { this.GetGroups(result, ReportHelper.GetServerLocalizedString("Option" + item), topItem, items.SelectMany(x => x.People) .Where(n => n.Type == item) .GroupBy(x => x.Name) .OrderByDescending(x => x.Count()) .Take(topItem) .Select(x => new ReportStatItem { Name = x.Key, Value = x.Count().ToString(), Id = GetPersonID(x.Key) }) ); } return result; }