Пример #1
0
        public async Task <InternalSeries> ImportSeries(string title)
        {
            try
            {
                var tmdbQueryShow =
                    await new WebClientManager().Get <TmdbQueryShow>(
                        $"{_configuration.Endpoints.Tmdb}/3/search/tv?api_key={_key}&language={_lang}&page=1&query={title}");

                var tmdbShowForID = tmdbQueryShow.Results[0];

                var tmdbShowSimple =
                    await new WebClientManager().Get <TmdbShow>(
                        $"{_endpoint}/3/tv/{tmdbShowForID.Id}?api_key={_key}&language={_lang}");

                var seasons = GetSeasons(tmdbShowSimple, tmdbShowForID.Id);

                return(new InternalSeries
                {
                    ExternalIds = new Dictionary <string, string>()
                    {
                        { "TmdbId", tmdbShowSimple.Id }
                    },
                    TmdbId = tmdbShowSimple.Id,
                    Runtime = tmdbShowSimple.EpisodeRunTime.Select(x => x.Length.ToString()).ToList(),
                    Title = tmdbShowSimple.Name,
                    Seasons = await seasons,
                    //Categories = tmdbShowSimple.Genres.Select(x => x.Name).ToList(),
                    Description = tmdbShowSimple.Overview,
                    Rating = tmdbShowSimple.VoteAverage,
                    CreatedBy = tmdbShowSimple.CreatedBy.Select(x => new InternalCreator {
                        Name = x.Name
                    }).ToList(),
                    EpisodeRunTime = tmdbShowSimple.EpisodeRunTime,
                    FirstAirDate = tmdbShowSimple.FirstAirDate,
                    Genres = tmdbShowSimple.Genres.Select(x => new InternalSeriesGenre(x.Name)).ToList(),
                    LastEpisodeSimpleToAir =
                        InternalConverter.ConvertTmdbEpisodeToInternal(tmdbShowSimple.LastEpisodeToAir),
                    Networks = InternalConverter.ConvertTmdbNetworkToInternal(tmdbShowSimple.Networks),
                    Popularity = tmdbShowSimple.Popularity,
                    ProductionCompanies =
                        InternalConverter.ConvertTmdbProductionCompanyToInternal(tmdbShowSimple.ProductionCompanies),
                    Status = tmdbShowSimple.Status,
                    Type = tmdbShowSimple.Type,
                    VoteCount = tmdbShowSimple.VoteCount,
                    OriginalLanguage = tmdbShowSimple.OriginalLanguage
                                       //TODO: CAST FELSZEDÉSE
                });
            }
            catch
            {
                throw new InternalException(605, "Series not found on TMDB.");
            }
        }
Пример #2
0
        public IQpProblem Convert(IProfileMatchingProblem problem)
        {
            InternalConverter converter = SelectInternalBuilder(problem);

            return(new QpProblem.Builder()
                   .WithQMatrix(converter.AssembleQMatrix())
                   .WithCVector(converter.AssembleCVector())
                   .WithAMatrix(problem.A)
                   .WithBVector(problem.B)
                   .WithAEqualityMatrix(problem.Aeq)
                   .WithBEqualityVector(problem.Beq)
                   .Build());
        }
Пример #3
0
        public async Task <List <InternalSeason> > GetSeasons(TmdbShow tmdbShowSimple, string id)
        {
            var _tmdbSeasons = new List <TmdbSeason>();

            foreach (var season in tmdbShowSimple.Seasons)
            {
                var notSimpleTmdbSeason =
                    await new WebClientManager().Get <TmdbSeason>(
                        $"{_endpoint}/3/tv/{int.Parse(id)}/season/{season.SeasonNumber}?api_key={_key}&language={_lang}");
                _tmdbSeasons.Add(notSimpleTmdbSeason);
            }
            return(InternalConverter.ConvertTmdbSeasonToInternalSeason(_tmdbSeasons));
        }