コード例 #1
0
        private IEnumerable <Season> FilterVirtualSeasons(GetSeasons request, IEnumerable <Season> items)
        {
            if (request.IsMissing.HasValue && request.IsVirtualUnaired.HasValue)
            {
                var isMissing        = request.IsMissing.Value;
                var isVirtualUnaired = request.IsVirtualUnaired.Value;

                if (!isMissing && !isVirtualUnaired)
                {
                    return(items.Where(i => !i.IsMissingOrVirtualUnaired));
                }
            }

            if (request.IsMissing.HasValue)
            {
                var val = request.IsMissing.Value;
                items = items.Where(i => i.IsMissingSeason == val);
            }

            if (request.IsVirtualUnaired.HasValue)
            {
                var val = request.IsVirtualUnaired.Value;
                items = items.Where(i => i.IsVirtualUnaired == val);
            }

            return(items);
        }
コード例 #2
0
        public object Get(GetSeasons request)
        {
            var user = _userManager.GetUserById(request.UserId);

            var series = GetSeries(request.Id, user);

            if (series == null)
            {
                throw new ResourceNotFoundException("Series not found");
            }

            var seasons = series.GetItemList(new InternalItemsQuery(user)
            {
                IsMissing       = request.IsMissing,
                IsSpecialSeason = request.IsSpecialSeason,
                AdjacentTo      = request.AdjacentTo
            });

            var dtoOptions = GetDtoOptions(_authContext, request);

            var returnItems = _dtoService.GetBaseItemDtos(seasons, dtoOptions, user);

            return(new QueryResult <BaseItemDto>
            {
                TotalRecordCount = returnItems.Count,
                Items = returnItems
            });
        }
コード例 #3
0
ファイル: TvShowsService.cs プロジェクト: tnt-wolve/Emby
        public async Task <object> Get(GetSeasons request)
        {
            var user = _userManager.GetUserById(request.UserId);

            var series = GetSeries(request.Id, user);

            if (series == null)
            {
                throw new ResourceNotFoundException("Series not found");
            }

            var seasons = (series.GetItems(new InternalItemsQuery(user)
            {
                IsMissing = request.IsMissing,
                IsVirtualUnaired = request.IsVirtualUnaired,
                IsSpecialSeason = request.IsSpecialSeason,
                AdjacentTo = request.AdjacentTo
            })).Items.OfType <Season>();

            var dtoOptions = GetDtoOptions(_authContext, request);

            var returnItems = (await _dtoService.GetBaseItemDtos(seasons, dtoOptions, user).ConfigureAwait(false))
                              .ToArray();

            return(new ItemsResult
            {
                TotalRecordCount = returnItems.Length,
                Items = returnItems
            });
        }
コード例 #4
0
ファイル: TvShowsService.cs プロジェクト: mzalewski/Emby
        private IEnumerable <Season> FilterVirtualSeasons(GetSeasons request, IEnumerable <Season> items)
        {
            if (request.IsMissing.HasValue)
            {
                var val = request.IsMissing.Value;
                items = items.Where(i => (i.IsMissingSeason) == val);
            }

            if (request.IsVirtualUnaired.HasValue)
            {
                var val = request.IsVirtualUnaired.Value;
                items = items.Where(i => i.IsVirtualUnaired == val);
            }

            return(items);
        }
コード例 #5
0
        public object Get(GetSeasons request)
        {
            var user = _userManager.GetUserById(request.UserId);

            var series = _libraryManager.GetItemById(request.Id) as Series;

            if (series == null)
            {
                throw new ResourceNotFoundException("No series exists with Id " + request.Id);
            }

            var seasons = series.GetSeasons(user);

            if (request.IsSpecialSeason.HasValue)
            {
                var val = request.IsSpecialSeason.Value;

                seasons = seasons.Where(i => i.IsSpecialSeason == val);
            }

            seasons = FilterVirtualSeasons(request, seasons);

            // This must be the last filter
            if (!string.IsNullOrEmpty(request.AdjacentTo))
            {
                seasons = ItemsService.FilterForAdjacency(seasons, request.AdjacentTo)
                          .Cast <Season>();
            }

            var fields = request.GetItemFields().ToList();

            var returnItems = seasons.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
                              .ToArray();

            return(new ItemsResult
            {
                TotalRecordCount = returnItems.Length,
                Items = returnItems
            });
        }
コード例 #6
0
ファイル: TvShowsService.cs プロジェクト: egandt/Emby
        public async Task <object> Get(GetSeasons request)
        {
            var user = _userManager.GetUserById(request.UserId);

            var series = _libraryManager.GetItemById(request.Id) as Series;

            if (series == null)
            {
                throw new ResourceNotFoundException("No series exists with Id " + request.Id);
            }

            var seasons = series.GetSeasons(user);

            if (request.IsSpecialSeason.HasValue)
            {
                var val = request.IsSpecialSeason.Value;

                seasons = seasons.Where(i => i.IsSpecialSeason == val);
            }

            seasons = FilterVirtualSeasons(request, seasons);

            // This must be the last filter
            if (!string.IsNullOrEmpty(request.AdjacentTo))
            {
                seasons = UserViewBuilder.FilterForAdjacency(seasons, request.AdjacentTo)
                          .Cast <Season>();
            }

            var dtoOptions = GetDtoOptions(request);

            var returnItems = (await _dtoService.GetBaseItemDtos(seasons, dtoOptions, user).ConfigureAwait(false))
                              .ToArray();

            return(new ItemsResult
            {
                TotalRecordCount = returnItems.Length,
                Items = returnItems
            });
        }