Beispiel #1
0
        public static Option <SeriesMapping> FromData(AniDbSeriesMappingData data)
        {
            if (!IsValidData(data))
            {
                return(Option <SeriesMapping> .None);
            }

            var ids = new SeriesIds(
                int.Parse(data.AnidbId),
                data.TvDbId.MaybeInt(),
                data.ImdbId.MaybeInt(),
                data.TmdbId.MaybeInt());

            var defaultTvDbSeason = GetTvDbSeasonResult(data.DefaultTvDbSeason);

            var defaultTvDbEpisodeIndexOffset = data.EpisodeOffset;

            var episodeGroupMappings = data.GroupMappingList?.Select(EpisodeGroupMapping.FromData)
                                       .Somes()
                                       .ToList() ?? new List <EpisodeGroupMapping>();

            var specialEpisodePositions = ParseSpecialEpisodePositionsString(data.SpecialEpisodePositionsString);

            return(new SeriesMapping(ids, defaultTvDbSeason, defaultTvDbEpisodeIndexOffset,
                                     episodeGroupMappings, specialEpisodePositions));
        }
Beispiel #2
0
 public SeriesMapping(SeriesIds ids, Either <AbsoluteTvDbSeason, TvDbSeason> defaultTvDbSeason, int defaultTvDbEpisodeIndexOffset,
                      IEnumerable <EpisodeGroupMapping> episodeGroupMappings,
                      IEnumerable <SpecialEpisodePosition> specialEpisodePositions)
 {
     Ids = ids;
     DefaultTvDbSeason             = defaultTvDbSeason;
     DefaultTvDbEpisodeIndexOffset = defaultTvDbEpisodeIndexOffset;
     SpecialEpisodePositions       = specialEpisodePositions ?? new List <SpecialEpisodePosition>();
     EpisodeGroupMappings          = episodeGroupMappings ?? new List <EpisodeGroupMapping>();
 }