Exemplo n.º 1
0
        private async Task <List <Collection> > GetMovieRootItems(string id, CancellationToken cancellationToken)
        {
            Log.Information($"Asking for all root views for admin user with id {id}");
            var rootItem = await _embyClient.GetRootFolderAsync(id, cancellationToken);

            var items = await _embyClient.GetItemsAsync(new ItemQuery
            {
                ParentId = rootItem.Id,
                UserId   = id
            }, cancellationToken);

            return(items.Items.Where(x => x.CollectionType == "movies").Select(x => new Collection
            {
                Id = x.Id,
                Name = x.Name,
                Type = CollectionType.Movies,
                PrimaryImage = x.ImageTags.ContainsKey(ImageType.Primary) ? x.ImageTags.FirstOrDefault(y => y.Key == ImageType.Primary).Value : default(string)
            }).ToList());
        }