Esempio n. 1
0
        private Task <Either <ProcessFailedResult, TvDbEpisodeData> > MapEpisodeDataAsync(AniDbSeriesData aniDbSeriesData,
                                                                                          AniDbEpisodeData aniDbEpisodeData, ProcessResultContext resultContext)
        {
            var seriesMapping = _mappingList.GetSeriesMappingFromAniDb(aniDbSeriesData.Id, resultContext);

            return(seriesMapping.BindAsync(sm =>
            {
                var episodeGroupMapping = sm.GetEpisodeGroupMapping(aniDbEpisodeData.EpisodeNumber);

                var tvDbEpisodeData = _episodeMapper.MapAniDbEpisodeAsync(aniDbEpisodeData.EpisodeNumber.Number,
                                                                          sm, episodeGroupMapping);

                return tvDbEpisodeData.Match(
                    d => Right <ProcessFailedResult, TvDbEpisodeData>(d),
                    () => resultContext.Failed("Found a series mapping but failed to map the episode to TvDb"));
            }));
        }
 private void SetUpEpisodeMapping(AniDbEpisodeData from, TvDbEpisodeData to, ISeriesMapping seriesMapping)
 {
     _episodeMapper
     .MapAniDbEpisodeAsync(from.EpisodeNumber.Number, seriesMapping, Option <EpisodeGroupMapping> .None)
     .Returns(to);
 }