Ejemplo n.º 1
0
        private async Task <TvShow> GetTvShow(SearchedTvShow searchedTvShow)
        {
            var tvShow = await _searcher.GetTvShowDetailsAsync(searchedTvShow);

            if (!tvShow.HasEnded)
            {
                tvShow.Seasons = tvShow.Seasons.Append(new FutureTvSeasons
                {
                    SeasonNumber = tvShow.Seasons?.Any() == true ? tvShow.Seasons.Max(x => x.SeasonNumber) + 1 : 1,
                    IsAvailable  = false,
                    IsRequested  = tvShow.IsRequested ? RequestedState.Full : RequestedState.None,
                }).ToArray();
            }

            if (tvShow.IsMultiSeasons())
            {
                tvShow.Seasons = tvShow.Seasons.Prepend(new AllTvSeasons
                {
                    SeasonNumber = 0,
                    IsAvailable  = false,
                    IsRequested  = RequestedState.None,
                }).ToArray();
            }

            return(tvShow);
        }
Ejemplo n.º 2
0
        private async Task HandleTvShowSelection(SearchedTvShow searchedTvShow)
        {
            var tvShow = await GetTvShow(searchedTvShow);

            if (!tvShow.Seasons.Any() && tvShow.HasEnded)
            {
                await _userInterface.DisplayTvShowDetailsAsync(tvShow);

                await _userInterface.WarnShowCannotBeRequestedAsync(tvShow);
            }
            else if (tvShow.AllSeasonsFullyRequested())
            {
                if (tvShow.Seasons.OfType <FutureTvSeasons>().Any())
                {
                    await new FutureSeasonsRequestingWorkflow(_user, _searcher, _requester, _userInterface, _tvShowNotificationWorkflow)
                    .RequestAsync(tvShow, tvShow.Seasons.OfType <FutureTvSeasons>().FirstOrDefault());
                }
                else
                {
                    await _userInterface.DisplayTvShowDetailsAsync(tvShow);

                    await _userInterface.WarnShowHasEndedAsync(tvShow);
                }
            }
            else if (!tvShow.IsMultiSeasons() && tvShow.Seasons.OfType <NormalTvSeason>().Any())
            {
                await new NormalTvSeasonRequestingWorkflow(_user, _searcher, _requester, _userInterface, _tvShowNotificationWorkflow)
                .RequestAsync(tvShow, tvShow.Seasons.OfType <NormalTvSeason>().Single());
            }
            else
            {
                await RequestTvShowSeason(tvShow);
            }
        }
Ejemplo n.º 3
0
        private async Task <TvShow> GetTvShow(SearchedTvShow searchedTvShow)
        {
            var tvShow = await _searcher.GetTvShowDetailsAsync(searchedTvShow);

            if (tvShow.IsMultiSeasons())
            {
                tvShow.Seasons = tvShow.Seasons.Prepend(new AllTvSeasons
                {
                    SeasonNumber = 0,
                    IsAvailable  = false,
                    IsRequested  = RequestedState.None,
                }).ToArray();
            }

            return(tvShow);
        }